A singleton containing methods related to Io's garbage collector. Io currently uses a incremental, non-moving, generational collector based on the tri-color (black/gray/white) algorithm with a write-barrier.
Every N number of object allocs, the collector will walk some of the objects marked as gray, marking their connected white objects as gray and turning themselves black. Every M allocs, it will pause for a sweep where it makes sure all grays are marked black and io_frees all whites.
If the sweepsPerGeneration is set to zero, it will immediately mark all blacks as white again and mark the root objects as gray. Otherwise, it will wait until the sweepsPerGeneration count is reached to do this. By adjusting the allocsPerSweep and sweepsPerGeneration appropriately, the collector can be tuned efficiently for various usage cases. Generally, the more objects in your heap, the larger you'll want this number.
Returns a List containing all objects known to the collector.
Return the allocation step value as a Number.
Sets all objects as clean. Returns self.
Runs garbage collector. Returns the number of items collected.
Returns a List containing all dirty objects known to the collector.
Return the number of allocations per collector mark pass.
Returns the maximum number of bytes allocated by the collector.
Returns an object whose uniqueId is aNumber or nil if no match is found. Warning: This lookup currently scans all objects, so it is not efficient, though it should handle thousands of lookups per second.
Resets maximum number of bytes allocated by the collector. Returns self.
Sets the allocatedStep (can have a fractional component, but must be larger than 1). A collector sweep is forced when the number of allocated objects exceeds the allocatedSweepLevel. After a sweep, the allocatedSweepLevel is set to the allocated object count times the allocatedStep. Returns self.
Turns on/off printing of collector debugging messages. Returns self.
Sets the number of incremental collector marks per object allocation (can be fractional). Returns self.
Prints the collector's stats to standard output.
Return the time used so far by the collector in seconds.