Investigating Memory Results > Tuning Garbage Collection and Finding Over-allocations > Reducing Over-allocation of Objects
Over-allocation of objects can have a performance impact either by affecting GC overhead or if the objects are very expensive to create (for example, database connection objects). If you suspect over-allocation may be a problem, JProbe can help find the source code that is causing the allocations, so that you can correct it.
It is important to note that over-allocation is not always a problem. JVMs are tuned to optimize allocation, particularly of short-lived objects. Some techniques used to reduce allocation, such as object caching, can actually have a negative effect on garbage collection, so it is important to consult vendor documentation and to measure to see if your changes do improve performance.
Note This procedure assumes that the snapshot contains garbage collection data.
To determine the source of the allocations:
1 Right-click the snapshot and select JProbe > Open in Instances View.
2 Select Dead Count from the Investigate by drop-down list.
The bar at the top of the views shows a breakdown of the objects that have been allocated and garbage collected during the use case. You can drill down by clicking on segments of the bar, or you can sort the table by Dead Count and look for classes your code allocates. You can also filter the table to help you narrow the search. (For details, see Filtering Data in the Instances View.)
Often identifying a class or classes that are being allocated more than you expect is enough for you to know where to look in your program to change this behavior.