posts - 5,  comments - 0,  trackbacks - 0

           來到新公司 ,一切都還算習慣.好久沒怎么寫代碼. 這幾天沒什么任務,做個工具方便打補丁包. 和同事溝通了哈.簡單的說就是想做個自動編譯java,并且打包的工具.以前用過點ant,于是就用它了.大概寫了哈腳本.

          環境如下: ant1.7

                       jdk 1.42

          不過很不興 編譯大概3000多個文件.過程中出現了2個問題:

          1 out of memory 解決方式:在build.xml中<javac>指定memoryMaximumSize="1024m".問題解決.

          2 stackoverflow 開始感覺的是在eclipse 中 指定-Xss=100m.這個是指定堆棧的大小,不過問題還是存在.

          異常如下:

              [javac] Compiling 2230 source files to D:\60work\xyg60\test
              [javac] The system is out of resources.
              [javac] Consult the following stack trace for details.
              [javac] java.lang.StackOverflowError
              [javac]     at com.sun.tools.javac.v8.comp.Attr.visitApply(Attr.java:689)
              [javac]     at com.sun.tools.javac.v8.tree.Tree$Apply.accept(Tree.java:877)
              [javac]     at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)
              [javac]     at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1071)
              [javac]     at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)
              [javac]     at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)

             ....................................................................................................

          上網查了哈.發現是sun的一個bug:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6623981

          簡單描述如下:

          1.The cause of StackOverFlowError

          When compiling a source(javac ... *.java), the classes depending on
          the compiled source become translation objects if not existing on
          classpath. There is a max limit of source/class number set to be 502
          when analyzing a source code. Analytical information that javac holds
          internally grows to translate a huge amount of source program at a
          time and that results in a stack overflow.

          2.Why the option "-J-Xss10m" did not work

          The thread where stack overflow occurred was generated by OS when
          starting javac.exe. Its size was fixed to be 256KB on Windows so
          "-J-Xss10m" did not work. This option is valid only for the threads
          generated by Java VM.

          To solve the problem, one way is not to make a recursive call in the
          processing of javac.

          This problem was not seen in jdk 5.0.
          Posted Date : 2007-10-31 03:57:57.0

          Test case and instruction for reproduction has been added.
          Please see Comment section.
          Posted Date : 2007-11-27 10:13:04.0
          Evaluation :
          Fixing by starting the javac "work" in a new thread, to avoid any possible limitation of the primordial thread stack size by the OS.
          This applies to 5.0 and earlier, later JDKs have the launcher start the application in a new thread.
          Posted Date : 2008-08-25 19:28:25.0
          可恨的sun 竟然搞到1.5的update17才解決.
          下了個最新的jdk1.5update20 問題解決了.
          由于我打包的東東是要在jdk1.4中運行的.還要想把辦法把1.5的class 轉換成1.4的.....
          或者可以自己修改1.4的jdk.按照他的Evaluation ,來改jdk 這個放到有時間在搞.





          posted on 2009-08-14 15:09 suker 閱讀(331) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2009年8月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          常用鏈接

          留言簿

          隨筆檔案

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 布尔津县| 泸西县| 五河县| 临沧市| 望城县| 山阳县| 勃利县| 孟津县| 绥阳县| 方山县| 丹东市| 海门市| 永新县| 射阳县| 揭东县| 沧源| 绥德县| 木里| 桂林市| 临清市| 乌兰浩特市| 定日县| 德令哈市| 增城市| 石台县| 塘沽区| 天门市| 慈溪市| 攀枝花市| 安义县| 沾益县| 五常市| 昭觉县| 临潭县| 惠东县| 遵义市| 雷波县| 井研县| 股票| 榆社县| 扬中市|