I am founder and Master Developer of Plumbr, memory leaking detection tool. I enjoy solving problems, raising self-awareness and professional pride of developers around me. In my out-of-office time I am bookworm and computer games addict. Nikita is a DZone MVB and is not an employee of DZone and has posted 84 posts at DZone. You can read more from them at their website. View Full User Profile

Plumbr 1.1 - We Now Find PermGen Leaks

07.18.2012
| 3241 views |
  • submit to reddit
It’s been only a month since we released 1.0. But we already have something new and cool to ship - as of this version we also find the leaks in the JVM permanent generation.

PermGen leaks are a specific type of a memory leak the often happen during the redeploy phase.

I guess you all have faced the dreaded java.lang.OutOfMemoryError: PermGen space  at some point during your career. And I bet most of you have struggled to find the cause and fix for this. Worry no more - Plumbr now provides you the tools needed to find and fix those errors.

Receiving a java.lang.OutOfMemoryError: PermGen space signals that you have a Permanent Generation leak in your application. Which in turn means that whenever you redeploy the application in your application server, it leaves a lot of classes behind. Those old class definitions end up in your JVM permanent generation eating up precious memory. In our experience - a typical PremGen leak is quite large - anywhere between 2MB and 20MB. Considering that in most JVMs the default size of PermGen is less than 100MB it might take only a few redeploys before permanent generation runs out and server crashes.

Why is it important to fix it? It is a memory leak. Eating away your precious memory you could put into better use. In development and/or test environments it just means you have to restart your application servers every once in awhile. So in those environments its  your time you are spending waiting on another redeploy. And I bet you have better things to do with your time. Like reading this article for example.

In production systems things look a lot worse - you’ll need to account for the risk that every redeploy could literally kill your production application. So you are forced to do full JVM restarts with every new release instead of the redeploys. This takes more time and your end-users could face lost sessions and/or service outages. Also - the production systems tend to run on quite an expensive infrastructure, so it might not be financially reasonable to spend a large amount of the precious memory referencing to garbage.

In addition to the permgen leak discovery, we also improved Plumbr by:
  • fixing several issues related to hot attach UI. It will now be easier to add Plumbr to the running Java processes;
  • improving notification system - when Plumbr finds a leak you will now be alterted via e-mail;
  • displaying long stacktraces in the leak report a more compact and readable form;
  • fixing some bugs causing NullPointerExceptions during race conditions;

If you are facing leaks and cannot resolve them - go ahead, register and download Plumbr. If you are running an older version of Plumbr, we strongly recommend to download an upgrade.
Published at DZone with permission of Nikita Salnikov-tarnovski, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: