I realized that any application which uses hibernate, fails to undeploy completely in Glassfish 2.1.1. Many classes remain in memory after the undeployment process, you can check it using jmap and jhat.
I've done several tests, and figured out that only applications which had hibernate failed to have a clen undeploy process. My Database provider for Hibernate in all the cases were jTDS 1.2.5.
You don't even need to run the application. If you just deploy, and instantly undeploy, you will realize several classes in memory, many from your application and many from hibernate and its dependencies.
Is it possible to have a clean undeploy in Glassfish v2.1.1? I'm running out of permgen space all the time.