Exception in thread "Thread-14" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-44" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-58" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-46" java.lang.OutOfMemoryError: Java heap space
求指导,原因
多线程内存溢出

解决方案 »

  1.   


    package com.fanme.tulipcrawler.apps.crawlerchecker;import java.util.ArrayList;
    import java.util.List;public class ExcuteThread extends Thread {
    private static  int c; private List<IExcuteable> excuteables = new ArrayList<IExcuteable>(); private boolean isFinished; public ExcuteThread(List<IExcuteable> excuteables) {
    this.excuteables = excuteables;
    } @Override
    public void run() {
    c=0; while (!isFinished) {
    IExcuteable excuteable = null;
    synchronized (excuteables) { if (excuteables.size() > 0) {
    excuteable = excuteables.remove(0); } else {
    try {
    excuteables.wait();
    } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    } } if (null != excuteable) {
    System.out.println(this.getName() + " begin to execute");
    excuteable.excute();
    System.out.println(this.getName() + " success to execute");
    c++;
    System.out.println(c + " 已经 成功execute");
    } }
    } public boolean isFinished() {
    return isFinished;
    } public void setFinished(boolean isFinished) {
    this.isFinished = isFinished;
    }}
      

  2.   

    Exception in thread "Thread-46" java.lang.OutOfMemoryError: Java heap space
    at java.lang.String.toUpperCase(String.java:2637)
    at org.htmlparser.PrototypicalNodeFactory.createTagNode(PrototypicalNodeFactory.java:505)
    at org.htmlparser.lexer.Lexer.makeTag(Lexer.java:1181)
    at org.htmlparser.lexer.Lexer.parseTag(Lexer.java:1157)
    at org.htmlparser.lexer.Lexer.nextNode(Lexer.java:368)
    at org.htmlparser.scanners.CompositeTagScanner.scan(CompositeTagScanner.java:110)
    at org.htmlparser.util.IteratorImpl.nextNode(IteratorImpl.java:91)
    at org.htmlparser.Parser.extractAllNodesThatMatch(Parser.java:767)
    at com.fanme.tulipcrawler.html.HTMLPath.getNodes(HTMLPath.java:351)
    at com.fanme.tulipcrawler.html.HTMLPath.SelectOneConditionNodes(HTMLPath.java:143)
    at com.fanme.tulipcrawler.html.HTMLPath.SelectOneConditionNodesValues(HTMLPath.java:211)
    at com.fanme.tulipcrawler.html.HTMLPath.SelectNodes(HTMLPath.java:124)
    at com.fanme.tulipcrawler.html.HTMLUtil.getNodeCount(HTMLUtil.java:35)
    at com.fanme.tulipcrawler.apps.crawlerchecker.XmlChecker.checkseedpage(XmlChecker.java:343)
    at com.fanme.tulipcrawler.apps.crawlerchecker.XmlChecker.checkpage(XmlChecker.java:406)
    at com.fanme.tulipcrawler.apps.crawlerchecker.CheckPageExecutor.excute(CheckPageExecutor.java:16)
    at com.fanme.tulipcrawler.apps.crawlerchecker.ExcuteThread.run(ExcuteThread.java:41)
      

  3.   

    你开多了多少啊。
    一般我只有在读excel数据超过10000*30的时候才会出现。
    在run->debug->configrations->VM里面输入参数:-Xmx800m
    然后debug运行。
    如果还超的话改成1200
    还超的话你就得考虑改程序了