Open tsnl opened 2 years ago
Profiling results from demo3.scm, computing (fibonacci 30): operator new invoked by cons when constructing the argument rib r accounts for 46.07% of all execution time. These should be redirected to a faster, pre-allocated heap that the GC can own. |
All datatypes must offer some way to declare or mark their contents so that a single user-invoked function performs mark and sweep GC.
The user can run this GC function periodically. However, the sole onus of running the GC rests on the user: if an allocation fails, then the runtime crashes. This is not as scary as it seems: the user can garbage-collect extremely conservatively and then relax these constraints if performance is a concern. This encourages awareness of a program's allocation patterns.
This is also necessary because the user may interleave finalization code with a GC invocation, since C++ objects and Scheme objects may transparently intermingle.