The "OutOfMemoryError: PermGen space" message is normally encountered during development activites where a long-running JVM is asked to load/unload builds.
The message is a symptom of an incomplete garbage collection sweep where resources are not properly released upon unload/restart. There is no shortage of debate (Hibernate forum, Sun forum, Spring Framework forum ) regarding which codebase is responsible for this symptom, but the finger of blame has been pointed at CGLIB, Hibernate, Tomcat, and even Sun's JVM.
In my experience, the most pain-free method of resolving this issue is to switch from Sun's JDK implementation to BEA's freely available JRockit implementation.
On a recent project utilizing Tomcat 5.5.12 with Hibernate, I was plagued with this PermGen error, at times even experiencing it during web-based unit testing. Since making the switch to JRockit, I have not encountered this issue even once.
EasyMock 2 is a library that provides an easy way to use Mock Objects for given
interfaces.
EasyMock 2 Benefits
Hand-writing classes for Mock Objects is not needed.
Supports refactoring-safe Mock Objects: test code will not break at runtime when renaming methods or reordering method parameters
Supports return values and exceptions.
Supports checking the order of method calls, for one or more Mock Objects.