Swapping is not a conclusive indicator of leakage. It results from low physical memory. Use vmstat on Linux to get swap usage.
Try using a different machine, experiment with configurations --swap size, physical memory size, address space.
Swapping is not a conclusive indicator of leakage. It results from low physical memory. Use vmstat on Linux to get swap usage.
Try using a different machine, experiment with configurations --swap size, physical memory size, address space. If you are confident that the problem is in your program try this: Estimate the median and peak memory that your program should use. You must be able to account for all deviations from these metrics.
If you cannot, proceed to step 3. Assuming you did step 1 correctly and were able to account for all deviations, you can rule out the leak (sorry about such vague suggestions but debugging is only as good as the detective). You should now focus on GC tuning.
First, enable GC logging. See if your heap is actually full and where the GC is spending most of its time collecting. This may be a good starting point to start optimizations.
Try to see if adjusting GC options helps. Try experimenting with collection algorithms, max/min heap sizes, gen ratios etc. Only experiment when you have ruled out a leak (step 1). Assuming you did step 1 correctly and were not able to account for all deviations, you can assume that you have a leak somwhere.
Use a memory profiler to see what objects contribute to the heap size growth most. Leave a profiler running for an extended period of time --have your program handle some requests it routinely expects to get and then leave it relatively isolated after that. If the memory level keeps on growing you may have a leak somewhere.
If not, then it is probably not a memory leak. Can you pin point the part of your program that may be creating them? If yes, try sending several requests that only target that part of your program.
Does it replicate the problem deterministically? If no, repeat step 3. If yes, use divide and conquer and reapply step 3 till you can find the class/method that are the culprits.
It can be a certain combination of multiple portions as well (meaning that individually they may look innocent but together they may form a brilliant crime syndicate). Hope this helps, if not then please leave a comment to my post. All the very best on your exercise!
Thank you very very very much for this step-by-step... It's all that I know should be done but I need to be reminded of this from time to time. I was tired from last week debugging and didn't have the mindset to begin debugging like this, I'm currently going with it and looking if it's really a leak in the application or somewhere else in the OS. – piva May 16 at 19:09 no problems.
– Monster Truck May 23 at 11:29.
I would suggest you look into creating heap dumps without using jvisualvm. For Unix-based Oracle JVM's this is normally done by sending a signal 3 to the JVM using kill. For full details see startux.de/index.php/java/45-java-heap-d... You can then see if the patterns changes.
If you do not get an idea from this, then this might be because you are storing a sub-string from a very large original string (which carries the underlying string array around), or because you hold on to operating system resources like open database connections etc. You have checked your connection pool looks good?
If you aren't using it, I'd recommend using visual VM version 1.3.2 and all the plug-ins. It's a big jump up from earlier versions. What happens to the perm gen space?
What are the memory settings you're using? Min and max, of course, but what about perm space size?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.