While developing an Eclipse based application I encountered a troubling error java.lang.OutOfMemoryError: PermGen space.
It doesn’t help to allocate more more heap memory with -Xmx.
This error is caused when the Garbage collector’s Permanent Generation fills up. The garbage collector first fills up the Young Generation and then a Minor Collection is done, some objects that were not collected are put in next generation, the Tenured Generation. After it fills up a Major Collection is performed. Then there is the third generation which is the Permanent Generation. Especially applications with a lot of classes may fill up this part of the heap.
To fix this problem the default permanent generation heap segment can be increased from 64M to something else. I used 128M which worked great.
-XX:MaxPermSize=128m