Be happy with Java

          這就不行了?

          for ?( int ?i? = ? 1 ;?i? <= ? 10 ;?i ++ )? {
          // ????????????????int?i?=?7;
          ????????????MNPClientThread?mnpct? = ? new ?MNPClientThread(i);

          ????????????mnpct.start();
          ????????????System.out.println(i);
          ????????}

          public ?MNPClientThread( int ?i)? {
          ????????
          this .count? = ?i;
          ????}


          ????
          public ? void ?run()? {
          ????????
          try ? {
          ????????????
          for ( int ?i = 1 ;i <= 800000 ;i ++ ) {
          ????????????????StringBuffer?phoneNumber?
          = ? new ?StringBuffer( " 88600 " );
          ????????????????phoneNumber.append(count);
          ????????????????phoneNumber.append(
          " 0000 " );
          ????????????????phoneNumber.append(i);
          ????????????????Thread.sleep(
          800 );
          // ????????????????System.out.println("****************"+phoneNumber.toString());
          ????????????????MNPClientTest?client? = ? new ?MNPClientTest();
          ????????????????client.runTest(phoneNumber.toString());
          // ????????????java.util.Date?d2?=?new?java.util.Date();
          ????????????????System.out.println( " Thread? " ? + ?count? + ? " ?Runs " );
          // ????????????????System.out.println(new?java.util.Date());
          // ????????????????System.out.println(i);
          ????????????}

          ????????}
          ? catch ?(Exception?ex)? {
          ????????????ex.printStackTrace();
          ????????}

          ????}

          運行3小時左右,發了不到10Wquery就掛了???
          報這個:
          Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space

          我加了-Xms128m -Xmx800m 還是不行?是內存泄露嗎??

          posted on 2007-02-02 15:54 SYBIL@BLOGJAVA 閱讀(595) 評論(2)  編輯  收藏

          評論

          # re: 這就不行了? 2007-02-03 18:52 BeanSoft

          用線程池吧...這樣有點懸. 找個 Profiler 工具看看哪些東西的內存占用最多. 參考: http://www.aygfsteel.com/beansoft/archive/2006/11/27/83767.html 用 JProfiler4 調優 Weblogic 和 Tomcat 的視頻(原創)  回復  更多評論   

          # re: 這就不行了? 2007-02-17 02:07 喜來了

          向請教一下這是要做什么?  回復  更多評論   


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


          網站導航:
           
          主站蜘蛛池模板: 曲麻莱县| 敦化市| 景德镇市| 阳东县| 会同县| 肥乡县| 婺源县| 和硕县| 兴城市| 虞城县| 龙岩市| 金湖县| 东至县| 江源县| 行唐县| 盘锦市| 岱山县| 根河市| 澄城县| 神农架林区| 凌海市| 宁蒗| 桂阳县| 惠安县| 多伦县| 衡南县| 页游| 株洲市| 盐山县| 奉新县| 若羌县| 姜堰市| 库伦旗| 商水县| 崇州市| 阜康市| 同心县| 武威市| 广灵县| 出国| 府谷县|