user's session and weakly in a global hashmap (so that the cached items have multiple refer-
Figure 7-2. Retained Memory view in Memory Analyzer
The heap has some 1.4 GB of objects in it (that value doesn't appear on this tab). Even so,
the largest set of objects that is referenced singly is only 6 MB (and is, unsurprisingly, part of
GlassFish's OSGi classloading framework). Looking at the objects that directly retain the
largest amount of memory isn't going to solve the memory issues.
In this example, there are multiple instances of StockPriceHistoryImpl objects in this list,
each of which retains a fair amount of memory. It can be deduced from the amount of
memory consumed by those objects that they are the issue. In the general case, though, ob-
jects might be shared in such a way that looking at the retained heap won't show anything
The histogram of objects is a useful second step (see Figure 7-3 ).