Comment by JackSlateur

15 hours ago

As far as I know, java has 7 GC implementations, none of which are perfect, all of which have drawbacks

Lately, they seems to work with CRIU, various heuristics, multi-stage in-process bytecode compilation ..

Java is a mess, they are working hard to avoid fixing their issue (that nobody else have, so fixes are available)

>As far as I know, java has 7 GC implementations, none of which are perfect, all of which have drawbacks

Compared to Python's, all of them are beyond perfect. And 99.9% of the time you don't even need to use anything but the default.

  • > Compared to Python's, all of them are beyond perfect.

    I somehow understand the situation less after reading this.

    Is Python's GC bad, or are there cyclic reference issues? Is it possible to detect cyclic references perfectly? What does beyond perfect mean? If we have 7 and 0.1% of the time you need one of the 6 that is non-default, how do we choose? Is the understated version of "Compared to Python's, all of them are beyond perfect" "I think Java's are great"? If not, what about Python's impl makes it so lackluster to any of 7 of Java's?

    • > Is Python's GC bad, or are there cyclic reference issues?

      Unless you're being pedantic and including reference counting without cycle detection as GC, if your GC has cyclic reference issues, your GC is bad.

      > Is it possible to detect cyclic references perfectly?

      Yes? That's the entire point of tracing GC. You have some set of root objects that you start with (globals, objects on thread stacks, etc.) and then you mark every object that's reachable from them. Anything that's not reachable is garbage, even if there are cycles within them.

    • >Is Python's GC bad, or are there cyclic reference issues?

      Both can be true. The first can even be wholly or partly due to the second.

      On addition, the way it does it via RC causes fragmentation, poor locality for caches, and general slowness for mass allocations. And it's one-size-fits-all.

      Java has a much larger selection to pick to finetune specific use cases, which each being far greater for that use case. And the default no-need-to-think one (G1 iirc), is already faster and better than Python's.

      2 replies →