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 阅读(563) 评论(2)  编辑  收藏

评论

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

用线程池吧...这样有点悬. 找个 Profiler 工具看看哪些东西的内存占用最多. 参考: http://www.blogjava.net/beansoft/archive/2006/11/27/83767.html 用 JProfiler4 调优 Weblogic 和 Tomcat 的视频(原创)  回复  更多评论   

# re: 这就不行了? 2007-02-17 02:07 喜来了

向请教一下这是要做什么?  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: