I am reading through the presentation “Building memory efficient Java applications”, and saw that on slide 11 they ask the question: “How many live collections in a typical heap?”
The answer is 10k to millions.
I will be very humble and say that I do not know where I would begin with this question.
What is a live collection vs a “not live collection”? By collections, do they mean java.util.collections?
Do collections live in the heap? I suppose since they are not allocated on the stack, that only leaves the heap.
What is implied by the revelation that there are 10k to millions of collections living on the heap? I can only assume that this is a bad thing.
Yes, they are referring to
java.utilcollections. (They go into specifics on each collection type —HashSet,ArrayList, and so on — so yeah.)Collections do live on the heap, but once they can be garbage collected — once they’re not referenced by the running application — they are not considered “live.”
A high number of collections on the heap is not a bad thing — it is just an indication that collections are being used so often as to warrant a closer look at the collection implementations, and specifically their memory efficiency. (It’s arguably a good thing that people are using good abstractions extensively!)
They’re almost certainly not talking about just one application — I’d frankly assume that they took a number of real-world applications and ran an analysis on those.