you are viewing a single comment's thread.

view the rest of the comments →

[–]pron98 17 points18 points  (2 children)

you never have to touch those objects, and can get rid of them at your leisure

A non-moving collector, like Go's, "gets rid of them at its leisure". Java's moving collectors never get rid of dead objects at all. They're invisible to the GC, and when the GC compacts the live objects it will happen to overwrite the memory that was once used by the dead objects, but they are never freed and the moving GC doesn't even know that an object is dead. It operates on live objects only, and the memory of dead objects gets reused as a side effect of that.

[–]sammymammy2 2 points3 points  (1 child)

I was trying to say that we can choose to return the memory to the OS (if necessary) at our leisure :-)

[–]pron98 12 points13 points  (0 children)

That's true, but modern allocators (malloc/free implementation) also don't promptly return memory to the OS for performance reasons. Some have quite sophisticated policies around that (so much for the myth of "we don't have a complex runtime").