I use Java Swing to create a simple GUI software. There exists a button on the panel that will trigger the generation of an ArrayList
with a huge size. Each time I click this button the memory usage of my java program will increase significantly on my task manager, therefore I doubt that whether there exists the memory leakage problem.
After, I investigate my program by Jprofile and found (pictures below):
As the pictures show, after the huge ArrayList
is useless, the GC mechanism seems to work properly (really?). However, I want my program to reduce the committed size (instead of more free size) so that the total memory usage would be decreased when my program is idle.
I do not understand the Java memory usage, can anyone explain to me? How can I achieve my goal or the situation of my pictures is inevitable?