garbage collection safety for region-based memory management
In this paper, we prove the safety of integrating region-based memory management and Cheney-style copying garbage collection. The safety property relies on a refinement of the region typing rules that forbids dangling pointers during evaluation.To accommodate the triggering of garbage collection at any step in the evaluation process, we base our type-safety result for the region-based system on a small-step contextual semantics and show that whenever a well-typed expression reduces to another expression, possibly by deallocating a region, then no dangling pointer is introduced. Because there are no dangling pointers in the initial heap, no dangling pointers appear during evaluation.Although in principle, the refinement of the region typing rules leads to less flexibility and can cause worse memory behavior than when dangling pointers are permitted, experiments show that, for a range of benchmark programs, the refinement has little effect on overall memory behavior.
garbage collection standard ml region inference