\ ---- Garbage Collection ---- {{{
-variable gc-stack-depth
-
-: enable-gc
- depth gc-stack-depth !
- true gc-enabled ! ;
-
-: disable-gc
- false gc-enabled ! ;
+ ( Notes on garbage collection:
+ This is a mark-sweep garbage collector, invoked by cons.
+ The roots of the object tree used by the marking routine
+ include all objects in the parameter stack, and several
+ other fixed roots such as global-env, symbol-table, macro-table,
+ and the console-i/o-port.
+
+ NO OTHER OBJECTS WILL BE MARKED!
+
+ This places implicit restrictions on when cons can be invoked.
+ Invoking cons when live objects are stored on the return stack
+ or in other variables than the above will result in possible
+ memory corruption if the cons triggers the GC. )
+
+
: pairlike? ( obj -- obj bool )
pair-type istype? if true exit then
string-type istype? if true exit then