I thought that wouldn't be necessary because the images go out of scope at the end of the actionPerformed() method. As OP said, the images are eligible for GC as soon as the dialogues are closed. I am at a loss to understand why he is running out of memory.
Rob Camick wrote:. . . one way to give a hint to garbage collection is to set the variable to null . . .
So how large are these images on disc? 300MB (not Mb) corresponds to 75Mpx, which is about 10000×7500px, or more. Can you get a camera that will take photos with the resolution?
Luca Vanon wrote:. . . bigger images that increase like 200/300Mb every time they are loaded . . .
No, I didn't see the memory decrease, but there is no need for GC to occur when 94% of available memory is still vacant. Until we can see memory use not decrease when it is all occupied, we can't help.
. . . I'm sorry if I didn't give you more information, but my original question was more "theorical"... . . .
Luca Vanon wrote:...just take a look at the task manager and you will see that the memory allocation keep on growing and never decrease after the windows are closed.