[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about retrieveActiveBody()



On Mon, Jul 12, 2004 at 09:30:34AM -0500, Archie Cobbs wrote:
> My question is: why is "ms = null" in retrieveActiveBody()?
> 
> This is causing a problem in my application: since I'm using Soot as
> a library, in order to not leak memory I need to invoke releaseActiveBody()
> after analyzing each method. However, if I need to analyze that method
> again later, the second call to retrieveActiveBody() generates a
> NullPointerException. Instead, I'd rather that Soot re-read the method
> from the classfile and re-generated the Jimple.
> 
> Would there be any problem by simply removing the "ms = null" line?

It is there also because of memory issues. Specifically,
CoffiMethodSource links to the data structures used to store the
bytecodes of the method in coffi, which can be quite large since there
is an object for each bytecode, and they have links to their successors
and predecessors. I don't know that coffi supports throwing away the
information it has about a method and re-reading it from scratch.
You'd have to dig into coffi to find out.

Ondrej