To be clear at the top, I don’t have practical or theoretical background in language/compiler/memory management design. This is not a proposal for an improvement to Julia’s garbage collection. I have one of those “isn’t the solution simple?” ideas that only a total novice could think.
Why does GC need to freeze the operation of all threads to do a sweep?
As long as you have multiple threads available and you are only collecting objects in the “old generation” which have fallen out of scope for all processes, why couldn’t a thread managing GC free those memory locations while the other threads continue their worth?
you are only collecting objects in the “old generation” which have fallen out of scope for all processes
I’m a bit confused by what you mean. I’ve understood the old generation as being those objects that have repeatedly survived the collection process because they are still alive. But you seem to be implying almost the opposite if I understand you.
If you know that an object isn’t in scope anymore you don’t need a GC to free it, You need a GC to free memory the memory that doesn’t have an easily determinable lifetime from static analysis. The way you find the dead objects is by searching the memory graph of the entire application, which is why you need to freeze all the threads (unless you do fancy stuff that Julia doesn’t do).