问题
I'm currently running Jenkins on a mac mini with Xmx2048m set and a permgen space of 512, I have the 'Monitoring' plugin running and it shows Jenkins using ~200M memory (spiking at 400 during archives). This number is slowly creeping up as you can see below.
http://i.imgur.com/vTuIyTz.png
When I look at the java process using 'top' on the mac mini it is showing the memory at about 685M. This number creeps up quicker and, eventually, hits 2048 and Jenkins bombs out.
http://i.imgur.com/TojBjhI.png
When I reboot the machine, or restart Jenkins, the 'top' recording drops back to around 270M and the java monitor drops to around 150M. What could be causing the difference in these readouts?
Is there a way to determine what exactly is causing the memory leak? I'm assuming it's a plugin and, due to the leak being continuous rather on a 'per-build' basis, I'm inclined to think it's perforce polling or something similar.
Any assistance would be greatly appreciated.
回答1:
Have you tried to make a Thread dump and analyze where the memory is being used ?
Another way to figure out what is causing the problem might be looking in jenkins logs.
If you are using Tomcat as your server you could try to add monitor for memory leaks, more here
回答2:
You already suspect a plug-in to be the leaker, so why don't you deactivate one plug-in at a time and see if the leaking stops?
I don't how many plug-ins you've installed, but you should try to search for memory leak + plug-in name, maybe someone else had the same problem.
来源:https://stackoverflow.com/questions/24674912/java-memory-leak-only-jenkins-running-jenkins-war-analysis-shows-nothing-stra