Please sign in to comment.
Trigger full GC from CodeManager to fix memory use
There is a possible situation of excessive memory usage. It's when many CompiledCode objects are repeatedly created and internalized. In that case, many MachineCode objects are internally created but never collected. Thus, memory usage increases forever. The following test code exhibits the problem: prc = proc do end loop do prc.block.instance_variable_set(:@compiled_code, prc.block.compiled_code.dup) prc.call end In such a situation, CompiledCode objects are collected immediately as young objects by GC. It means that the full (mature) GC is never triggered. When CompiledCode is internalized, it creates a MachineCode object, a kind of CodeResource, which is managed and garbage-collected by CodeManager. Currently, CodeManager only collects unneeded code resources in full (mature) GC. So, if there is no trigger for the full GC, code resources are never collected. This is usually fine because code resources are created very spontaneously under normal conditions. To fix this, when centain number of code resources (currently, 64 MiB in data size wise) are newly added, trigger the full GC from CodeManager. Closes #2224.
- Loading branch information...
Showing with 11 additions and 3 deletions.