users@glassfish.java.net

Jsr199JavaCompiler possible memory leak?

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 Jan 2009 11:09:01 PST

Hi folks.

First of all, first post, have to say that I've been using the Jsr199JavaCompiler option and it has delivered such a performance boost, well done.

However, I suspect there may be a memory leak in the implementation (as confirmed by some memory dump analysis)

From my read of the code there is a line to add the compiled bytecode to a list within a packageMap table stored within the JspRuntimeContext

Thats fine, except when the jsp reloads, the code continues to add new instances rather than replacing the existing one. I've had cases where a few hundred jsp's consume nearly 2gb of non gc'able memory.

I'd recommend the following:
+ // remove the file (if present)
+ packageFiles.remove(classFile);
packageFiles.add(classFile);
classFiles.add(classFile);
[Message sent by forum member 'finbarro' (finbarro)]

http://forums.java.net/jive/thread.jspa?messageID=326040