top | item 44656693

(no title)

jabiko | 7 months ago

> Java garbage collection is both great, and terrible. Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't.

In the last decade of writing Java software I didn't ever come across a genuine GC bug where a unreferenced object wasn't collected. I'm not disputing that they exist, but if you regularly hit such "bugs" I'm wondering if your understanding of Java GC might be flawed.

Do you expect objects to be immediately collected when they are not reachable anymore?

discuss

order

happymellon|7 months ago

No its not regularly, I think just once in at least 10 years, probably longer. And it could easily be either a Spring bug, or bad configuration through misunderstanding.

My point was more that it can be opaque when it doesn't act as expected. Sometimes heap inspection is helpful, but if you use Kafka or Spring Data, etc, it can easily just appear to be a char or int array.

lucianbr|7 months ago

So you hit this bug about one and a half times in your entire career, you're not sure Java caused it or even if it was really a bug, but due to it you have a love/hate relationship and garbage collection is terrible?