herdann 2009-10-13 15:27
浏览 288
已采纳

java Vector的最大size是多少阿?

读一个文件(每行是一条记录,一共60040行),把每一行包装成一个LogBean,存放到Vector里面,
然后把Vector 传给数据库连接,
每行对应一个数据库的insert纪录。
就是说读出所有行,然后insert 到数据库中。

[code="java"]
Vector list = new Vector();
String[] nextLine;
while ((nextLine = reader.readNext()) != null) {

            LogBean bean = new LogBean();
            bean.setName(nextLine[0]);
            bean.setID(nextLine[1]);
            bean.setTEAM("TEAM");
            bean.setSUB_TEAM("SUBTEAM");                
            list.add(bean);

            rows++;
        }[/code]

是在web叶面上处理的。

Tomcat 报错了, 我看了一下报错的文件有60040行 ,就是说我的vector的size 是60040,是不是这会导致outOfMemory?
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.OutOfMemoryError: Java heap space

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.

  • 写回答

2条回答 默认 最新

  • iteye_20589 2009-10-13 15:33
    关注

    这么多行一次操作,产生java.lang.OutOfMemoryError: Java heap space 异常很正常。
    下面链接是这个异常的解决方法,不过你这么多数据操作对内存要求太高了。
    就算自己设置的话,也不知道你内存有那么大没。。
    [url]http://blog.csdn.net/jxzxm1_2/archive/2008/05/31/2499751.aspx[/url]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏