I am working on a big application deployed in Glassfish 4. I have one job which is downloading files and storing them in the database as byte[]. There are lot of small files (like 5 Mb). I got an out of memory error so I tried to start the job again with smaller number of files and started monitoring it with jVisualVM and noticed this:
Between 1:30 and 1:40 it is the normal application run, we can see that everything looks as expected. However when I start my job after 1:40 the used heap is often garbage collected so there are a lot of spikes... However, the Heap size is getting lower and lower. I guess this was the cause of the out of memory error. But I have no idea what that means - what does it mean whe the heap size is being lowered?