View Single Post
Capt'n Corrupt's Avatar
Posts: 3,524 | Thanked: 2,958 times | Joined on Oct 2007 @ Delta Quadrant
#202
Another benefit to the GC scheme I previously mentioned is that the GC would be free to collect on a separate de-prioritized thread.

Currently (according to the aforementioned post), the GC must analyse a runtime object hierarchy which means that it must freeze the thread whilst running. This would degrade performance terribly. By analyzing de-allocation when it happens, the GC wouldn't need to interfere with a running system at all and could be run completely separate and with a minimum priority!

Not only is it trivial to detect inaccessible objects (O(1)), but it is also less disruptive to freeing them for future allocation. Everyone wins.

Taken a step further: compile time optimization could isolate objects that are short-lived. This would apply to objects that used only momentarily in a method or loop block, and spare these from GC altogether (eg. parameters, counters, etc).

I'm probably missing something obvious, or if not, am scratching my head as to why GC isn't handled this way.