3 ms·
Hoping the GC kicks in rarely is not a great strategy. Usually when I see something like this the developers have gone out of their way to write garbage-free co
by papercrane 11y ago
Hoping the GC kicks in rarely is not a great strategy. Usually when I see something like this the developers have gone out of their way to write garbage-free code (see Coral Blocks for an example of this.)
- rainhacker 11y agoIf a code is truly garbage free (not sure how practical this is) won't it be independent of the heap size ? I know some teams do claim to write garbage free code to prevent GC from ever kicking of.
- papercrane 11y agoYeah, actually I think you're right. I don't think you can actually disable the GC in JVM unless you patch it. Truly garbage free is probably not practical 99% of the time. Normally you should just generally try to either have objects that are short-lived or practically permanent.
- cam- 11y agoAgree, you want the GC sipping constantly, not gulping, or embarrassingly pulling up its pants.