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 喜來了

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


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


          網站導航:
           
          主站蜘蛛池模板: 镇雄县| 虹口区| 呼图壁县| 句容市| 鄂伦春自治旗| 沅江市| 永清县| 雷州市| 申扎县| 曲周县| 松江区| 开封县| 靖安县| 泗水县| 新余市| 肇东市| 平顺县| 通河县| 太仆寺旗| 巴林右旗| 密云县| 华阴市| 南平市| 五原县| 临夏县| 广州市| 杭锦后旗| 河源市| 肇源县| 东乡族自治县| 龙山县| 华亭县| 阳山县| 申扎县| 新闻| 苏州市| 崇义县| 四川省| 双柏县| 定州市| 馆陶县|