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小時左右,發(fā)了不到10Wquery就掛了???
          報這個:
          Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space

          我加了-Xms128m -Xmx800m 還是不行?是內(nèi)存泄露嗎??

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

          評論

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

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

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

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


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 秦安县| 临江市| 宁南县| 甘德县| 泸西县| 鄱阳县| 南溪县| 天镇县| 光山县| 镇康县| 邛崃市| 盱眙县| 海晏县| 嘉荫县| 钟山县| 隆安县| 巴塘县| 新丰县| 梧州市| 昌宁县| 濮阳县| 常熟市| 玉门市| 罗山县| 虎林市| 永福县| 屯留县| 越西县| 天镇县| 桐柏县| 都兰县| 新昌县| 鹿邑县| 华阴市| 肃北| 安溪县| 赫章县| 吴忠市| 铜川市| 宁陕县| 安西县|