Groups | Blog | Home
all groups > macromedia flash flash remoting > december 2004 >

macromedia flash flash remoting : Memory Leak and Performance problem in flashgateway.jar


mikelawrence
12/20/2004 5:48:07 PM
Macromedia,

There is a large memory leak in the flashgateway.jar. Each time a flashgateway
method is called it is added to a method cache hashMap to reduce the number of
Java introspection calls However, the key it is using is a StringBuffer object
instead of the toString() value. Therefore, it will never be cached, and the
cache will continue to grow, slowing down the system as it takes longer and
longer to insert and search the hash map. Here is the fixed code with the
toStrings() added:

flashgateway.adapter.java.JavaAdapter:

/* 113*/ if(methodCache.containsKey(methodKey.toString()))
{
/* 115*/ method = (Method)methodCache.get(methodKey.toString());

/* 214*/ methodCache.put(methodKey.toString(), method);




ejastegall
3/2/2005 8:01:39 PM
I'm experiencing this too! I've been using jprofiler to watch and am finding
the same problem that you outline here. The memory that is lost is only a
small amount each method call but over time and as the number of calls grows it
almost becomes unusable. My application makes sometimes 100 or 200 calls a
minute and I have to reboot every 4 days to keep it running even with a gig of
heap space. I am changing the JavaAdapter class currently to fix the memory
leak but ya'll should consider revisiting this code as well!
AddThis Social Bookmark Button