Here is a list of related documents. By and large, you may have a look into framework/appserver to choice your server if it's there...
If you use Tomcat you should have a look at the JRE Memory Leak Prevention Listener.
If you don't, check if a such mechanism is not provided by your application server.