I have designed a web application system that have mutiple domains, and in each domain I have a servletContext varaible to be used by all other servlet. and when I want to choose different domain, I need to free that servletContext variable to save memory. I have tried to kill the servletContext varaible by assigning null to itbut it does not seem to work.
Make sure that whatever object is associated with "OWL" isn't referenced anywhere else, so that it is eligible for GC. The reference to it in the servlet context takes up hardly any memory at all by itself.
You shouldn't do that, though. Firstly, it's not "calling the GC", it's "asking the JVM to run a GC" which may well not happen (see the javadocs). And secondly, the JVM will run the GC on its own anyway if there's a need for it (low memory) - it's unnecessary to remind the JVM to do it.
Joined: Mar 28, 2007
Ok, thanks for the info...
subject: how to mannually free the servletContext variable to free memory?