My guess is that CodeBlock has some problem.
CodeBlockSet contains CodeBlocks, but it is removed when the destructor is called. Is this correct mechanism? Iām thinking that it is wrong with incremental sweeping and conservative scan.
I think conservative-scan & CodeBlockSet combination is OK, but still I think CodeBlockSet is potentially dangerous. CodeBlock is registered to that set when it is created, and it is removed when CodeBlock::~CodeBlock destructor is called. This means that CodeBlock is included when CodeBlock is already dead but its destructor is not called (not swept yet). If the client of CodeBlockSet does not account the possibility that touching CodeBlock is now dead, having a bad time. The safer way is removing dead CodeBlocks when GC finalizing happens.