<div dir="ltr"><div>So I&#39;m trying to run soot with spark on the Android Framework using a custom entry point.</div><div><br></div><div>Here is my the code that runs soot:</div><div>   </div><div>    public class Main {</div><div>        public static void main(String[] args) {</div><div><br></div><div>            String entryPointClass = args[args.length-2];</div><div>            String entryPointMethod = args[args.length-1];</div><div><br></div><div>            System.out.println(entryPointClass + &quot;.&quot; + entryPointMethod);</div><div><br></div><div>            args = Arrays.copyOf(args, args.length-2);</div><div><br></div><div>            long start = System.currentTimeMillis();</div><div>            Options.v().parse(args);</div><div>            SootClass c = Scene.v().forceResolve(entryPointClass, SootClass.BODIES);</div><div>            c.setApplicationClass();</div><div>            Scene.v().loadNecessaryClasses();</div><div>            SootMethod method = c.getMethodByName(entryPointMethod);</div><div>            List entryPoints = new ArrayList();</div><div>            entryPoints.add(method);</div><div>            Scene.v().setEntryPoints(entryPoints);</div><div>            PackManager.v().runPacks();</div><div><br></div><div>            soot.jimple.toolkits.callgraph.CallGraph callgraph = Scene.v().getCallGraph();</div><div>            System.out.println(&quot;[TestSpark] Call graph size &quot; + callgraph.size());</div><div><br></div><div>            System.out.println(String.format(&quot;It took: %d seconds to generate a callgraph for: %s&quot;,</div><div>                    TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - start),</div><div>                    entryPointClass +&quot;.&quot;+ entryPointMethod));</div><div>            }</div><div>}</div><div><br></div><div>I would run this as follows:</div><div>java -Xmx:1024mb -jar mySpark.jar -p cg.spark on -process-dir /Users/jason/Desktop/android/pscout/android_source_dir/ -cp /Users/jason/Desktop/android/pscout/android_source_dir:. -allow-phantom-refs android.content.ClipboardManager hasText</div><div><br></div><div>The last two args end up being the api class and the api method that I want to start the graph at.  </div><div><br></div><div>When I run this jar I get a &quot;java.lang.OutOfMemoryError: GC overhead limit exceeded&quot; error.  I&#39;ve given the JVM as mucha s 8gb and it still exhausts memory.</div><div><br></div><div>Now I must admit that to even get this to work I had to tweak the Soot source code a bit.  I had to alter the following:</div><div><ul><li>Line 99 in soot/src//soot/asm/SootClassBuilder.java will not throw an exception with my code.  The line now prints an error and moves on.  As I was reading the code and reading other examples, this is tolerable because Soot still finds the methods in those classes (presumably, as it doesn&#39;t throw any errors about not finding methods)<br></li></ul><div>Can soot handle the entire android framework?</div></div><div>Is my method and approach proper?</div><div>Are there any indications as to why I&#39;m running into a GC Memory error and how to fix it?</div><div>Is my change to soot source code the root of this problem?</div><div><br></div><div>Thank you for any assistance you may provide.</div></div>