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

Re: java.lang.OutOfMemoryError



Hi,

	Soot does require a lot of memory, but be careful about those numbers. The VM 
starts with a predetermined maximum heap size, which is much smaller than 
your 170 mb. Therefore, you may very well get an OutOfMemory error while 
there is still plenty of room in your RAM (which seems to be the case for 
you). To increase this limit, you can usually invoke 'java' with the -Xmx 
flag, like so:

$ java -Xmx128m soot.Main ...

which will allow the heap to grow up to 128 mb. There is also the -Xms flag 
which is used to same way but specifies the initial size of the heap.

Cheers,

	Bruno

On Friday 24 January 2003 12:18 pm, Eric Bodden wrote:
> Hi!
>
> Could it be that invoking CHA (with preparation for VTA, means all
> ContextClasses set to LibraryClasses) uses more than 100MB RAM on a
> simple Hello World program? Just because I tried that today and first it
> took several minutes and after that the thread died with a
> java.lang.OutOfMemoryError... When I started the program, the task
> manager told me I had around 170MB physical RAM available. At the point
> I start CHA (after laoding the classes) there were still 140MB
> available.
>
> Thanks,
> Eric
>
> P.S. Here my test code:
> 	public static void main(String argv[]) throws Exception{
>
>             System.out.println(new java.util.Date() + " setting
> classpath");
>
> soot.Scene.v().setSootClassPath("D:\\Apps\\Coding\\Java\\J2SDK\\sdk1.4.1
> _01\\jre\\lib\\rt.jar;.");
>
>             System.out.println(new java.util.Date() + " loading test
> class");
> 		soot.Scene.v().loadClassAndSupport( "Hello"
> ).setApplicationClass();
>
>             System.out.println(new java.util.Date() + " changing to
> libary classes");
> 		java.util.Iterator contextClassesIt =
> Scene.v().getContextClasses().snapshotIterator();
> 		while (contextClassesIt.hasNext())
>
> ((SootClass)contextClassesIt.next()).setLibraryClass();
>
>             System.out.println(new java.util.Date() + " starting CHA");
> 		InvokeGraph graph =
> ClassHierarchyAnalysis.newInvokeGraph();
>
>             System.out.println(new java.util.Date() + " starting VTA");
> 		VariableTypeAnalysis VTA = new VariableTypeAnalysis(
> graph );
>
>             System.out.println(new java.util.Date() + " trimming
> Graph");
>             VTA.trimActiveInvokeGraph();
>
> 	}
>
> ------------------------------------------------------------
> Eric Bodden
> University of Kent at Canterbury