Its only after I shut down my PC and restart it again, that the "out of memory" fades off. I was looking for a quick fix so that I can continue development without having to restart my pc every now and then.
From my experience with
Tomcat it's often too late for a regular shutdown, when the server JVM hangs because of an out-of-memory problem. But it shouldn't be necessary to restart your computer in order to force the JVM to shutdown. It should be enough to kill the corresponding
Java process. Depending on your OS you'll have to use the Windows task manager, a Linux console or something like this to find and kill the Java process which belongs to the Glassfish server. But
you should take care not to kill other Java process for example the one for your NetBeans IDE ;-) On Linux it's easy to find the right Java process because you can usually see the whole command line for the process in question and figure out if it's the JVM process used to startup Glassfish.
Hope this helps with your development although I don't know how to solve the root cause of the problem!
Marco