soga07 / smali

Automatically exported from code.google.com/p/smali
0 stars 0 forks source link

OutOfMemoryError #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

My problem is:

    Every run of smali just shows OutOfMemoryError error, instead of
    showing the help message.

Here is how I run:

khchoi@khchoi-desktop:~/Work/Dalvik/smali$ java -Xms2048000000 -cp 
./commons-cli-1.2.jar:./dexlib/target/dexlib-1.3.1-dev.jar:./util/target/util-1.
3.1-dev.jar:./antlrworks-1.4.3.jar:/home/khchoi/Work/Dalvik/smali/smali/target/s
mali-1.3.1-dev.jar org.jf.smali.main 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2882)
    at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
    at java.lang.StringBuffer.append(StringBuffer.java:224)
    at org.apache.commons.cli.HelpFormatter.renderWrappedText(HelpFormatter.java:849)
    at org.apache.commons.cli.HelpFormatter.printWrapped(HelpFormatter.java:694)
    at org.apache.commons.cli.HelpFormatter.printUsage(HelpFormatter.java:646)
    at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:481)
    at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:418)
    at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:381)
    at org.apache.commons.cli.HelpFormatter.printHelp(HelpFormatter.java:364)
    at org.jf.smali.main.usage(main.java:425)
    at org.jf.smali.main.usage(main.java:439)
    at org.jf.smali.main.main(main.java:98)

----
Here is a description of my environment.

   - Smali : 1.3.1-dev
     (I built a version of the smali source I downloaded
      from the source repository by git yesterday.)
   - Apache Maven 2.2.1
   - Ubuntu 10.0.4 LTS
   - java/javac : 1.6.0_30

I used the following packages:
   - commons-cli-1.2.jar
   - antlrworks-1.4.3.jar

Could you help me to know what is my problem? Please let me know if you need 
further information by sending an email to lazyswamp@gmail.com.

Thanks in advance!

Kwanghoon Choi

Original issue reported on code.google.com by lazysw...@gmail.com on 9 Jan 2012 at 10:20

GoogleCodeExporter commented 9 years ago
This might not be a problem of smail. I tried to run it on Mac, and succeeded. 
The different things I now have:
  - antlr-runtime-3.2
  - maven 3.0.3

The command I gave is

  $ java -cp $COMMONS_CLI/commons-cli-1.2.jar:./dexlib/target/dexlib-1.3.1-dev.jar:./util/target/util-1.3.1-dev.jar:./smali/target/smali-1.3.1-dev.jar:$ANTLR_3_2/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar org.jf.smali.main

The OS is
  Mac OS X 10.7.1

Do you see any big difference between the two commands I have tried, except the 
operating systems? 

Thanks in advance.

K. Choi

Original comment by lazysw...@gmail.com on 9 Jan 2012 at 3:02

GoogleCodeExporter commented 9 years ago
I suspect you need to use the -Xmx parameter to set the maximum heap size. I 
don't think the -Xms parameter will use a heap size that is greater than the 
maximum.

I'll keep the issue open for now. Let me know if using -Xmx works for you so I 
can close the issue :)

Original comment by jesusfreke@jesusfreke.com on 12 Jan 2012 at 4:57

GoogleCodeExporter commented 9 years ago
Thanks for your feedback. As you guided, I changed -Xms into -Xmx. But the 
problem still arose. I tried the maximum heap size upto 2 Giga bytes, but in 
vain. In fact, I don't think the behavior is normal because the program is not 
thought to use so much memory to print a help message. I'll keep looking at 
this issue. 

Thanks again.

K. Choi

Original comment by lazysw...@gmail.com on 12 Jan 2012 at 10:08

GoogleCodeExporter commented 9 years ago
This looks like what I see when I run from within an emacs shell buffer. 
Outside emacs things work fine.

Original comment by b...@google.com on 11 May 2012 at 11:18

GoogleCodeExporter commented 9 years ago
Thanks bdc! I was able to reproduce using emacs shell.

It turned out to be a problem with terminals that don't report their width. The 
help formatter was trying to format the usage information with 0 width, and was 
apparently getting into an infinite loop and using up all the memory.

Original comment by jesusfreke@jesusfreke.com on 13 May 2012 at 7:43

GoogleCodeExporter commented 9 years ago
Thanks all!

I got the problem in Ubuntu where I used Emacs, while I didn't get any problem
in Mac where I did not used Emacs.

Kwanghoon

Original comment by lazysw...@gmail.com on 14 May 2012 at 9:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fixed - 
http://code.google.com/p/smali/source/detail?r=36c2f08ba064bce2a447f9280bcf80177
cb4b9b9

Original comment by jesusfreke@jesusfreke.com on 15 May 2012 at 5:07

GoogleCodeExporter commented 9 years ago
I have the problem as follows:

host Prebuilt: antlr 
(out/host/common/obj/JAVA_LIBRARIES/antlr_intermediates/javalib.jar)
target Generated: smali <= 
external/smali/smali/src/main/antlr3/org/jf/smali/smaliLexer.g
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Vector.<init>(Vector.java:111)
    at java.util.Vector.<init>(Vector.java:124)
    at org.antlr.analysis.DFA.createTransitionTableEntryForState(DFA.java:551)
    at org.antlr.analysis.DFA.createStateTables(DFA.java:440)
    at org.antlr.codegen.CodeGenerator.genLookaheadDecision(CodeGenerator.java:645)
    at org.antlr.grammar.v3.CodeGenTreeWalker.block(CodeGenTreeWalker.java:2876)
    at org.antlr.grammar.v3.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:2382)
    at org.antlr.grammar.v3.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:1537)
    at org.antlr.grammar.v3.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.java:1441)
    at org.antlr.grammar.v3.CodeGenTreeWalker.grammar_(CodeGenTreeWalker.java:461)
    at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:421)
    at org.antlr.Tool.generateRecognizer(Tool.java:655)
    at org.antlr.Tool.process(Tool.java:468)
    at org.antlr.Tool.main(Tool.java:93)
make: *** 
[out/host/common/obj/JAVA_LIBRARIES/smali_intermediates/smaliLexer.java] Error 1
But I try the comment8 solution, but it has the same problem. 
Hilda
Thanks.

Original comment by hilda.ch...@gmail.com on 24 Sep 2012 at 9:57