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

Re: Question about retrieveActiveBody()



I've run into problems with this myself, related to memory management:

In particular, retrieveActiveBody releases the methodSource, but unless you
retrieve all of the bodies, then there is still a dangling reference to the (rather large)
Coffi classes. The end result when processing reachable methods is that most of the
JVM files are coffi parsed, but only some of the methods are ever retrieved, meaning that
All of the coffi objects for most of the JVM must be kept around.... This results in
quite a bit of the non-transient memory allocation of running soot in many cases.


I haven't had good suggestions for improving this, you generally have to make
a tradeoff of memory usage vs. possibility of hitting the disk again...

Steve

At 09:36 AM 7/12/2004, Ondrej LHOTAK wrote:
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