For one application, we've installed our business-logic as Java Stored Procedures.
The problem is that, usually after one day of work, or sometimes before the end of the day, we receive the following message :


I. 02/24 17:01:32. java.lang.OutOfMemoryError: PermGen space
I. 02/24 17:01:34. Exception in thread "Thread-593" java.lang.OutOfMemoryError: PermGen space

or

I. 02/26 16:11:14. java.lang.OutOfMemoryError: PermGen space
I. 02/26 16:11:14. at java.lang.ClassLoader.defineClass1(Native Method)
I. 02/26 16:11:14. at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
I. 02/26 16:11:14. at java.lang.ClassLoader.defineClass(ClassLoader.java :465)
I. 02/26 16:11:14. at ianywhere.sa.jvm.SAClassLoader.findClass(SAClassLo ader.java:491)
I. 02/26 16:11:14. at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
I. 02/26 16:11:14. at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
I. 02/26 16:11:14. at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
I. 02/26 16:11:14. at java.lang.Class.getDeclaredConstructors0(Native Method)
I. 02/26 16:11:14. at java.lang.Class.privateGetDeclaredConstructors(Cla ss.java:2357)
I. 02/26 16:11:14. at java.lang.Class.getConstructor0(Class.java:2671)
I. 02/26 16:11:14. at java.lang.Class.newInstance0(Class.java:321)
I. 02/26 16:11:14. at java.lang.Class.newInstance(Class.java:303)
I. 02/26 16:11:14. at ianywhere.sa.jvm.SAJvm.executeMethod(SAJvm.java:10 60)
I. 02/26 16:11:14. at ianywhere.sa.jvm.SAJvm.run(SAJvm.java:196)


The only way (I known) to resolve this, is to stop and restart the database.
To prevent this, I stop and restart the database in the evening, but this is not a solution we want to maintain.
Even if I restart the database, we sometimes have to restart the database in the afternoon.

In the database-options, for property 'java_vm_options', I've entered the value : -XX:MaxPermSize=256m
But this also doesn't solve the problem.


So I presume the problem is that some kind of resources (memory) gets exhausted.

Then I started thinking of a memory leak. So I installed a procedure that generated memory leaks on a test-database.
But until now, I couldn't duplicate the problem.

Any advice is welcome.