【问题标题】:Create excel using poi raise exception使用 poi 引发异常创建 excel
【发布时间】:2013-06-02 02:46:16
【问题描述】:

我正在使用 eclipse 使用 POI 从 Oracle 数据库创建 excel 文件。如果数据集小没问题。但如果它很大,我们会遇到以下异常。

线程“主”java.lang.OutOfMemoryError 中的异常:Java 堆空间

My heap setting is. -Xms512m -Xmx1024m

如果我将最大尺寸增加到 2048m,我们得到了

Could not create Java Virtual Machine.

错误。谢谢

【问题讨论】:

    标签: java eclipse apache-poi


    【解决方案1】:

    我觉得你需要检查一下你的操作系统的容量是多少(是32位系统还是64位系统)

    据我所知:

    32 位 JVM 期望有一个大块内存不能使用超过 4 Gb(因为这也是 32 位限制,也适用于指针)。这包括 Sun 和 - 我很确定 - 还包括 IBM 实现。我不知道是否例如JRockit 或其他人的 32 位实现具有大内存选项。

    如果您希望达到此限制,您应该强烈考虑为您的生产环境启动一个验证 64 位 JVM 的并行跟踪,以便在 32 位环境出现故障时做好准备。否则你将不得不在压力下做这项工作,这绝不是好事。

    Extra information:
    On normal consumer versions of Windows, the limit is 2GB 
    which is equivalent to 2048M. On Linux and server versions 
    of Windows (32-bit) 
    the limit is 3GB per process.
    

    【讨论】:

      【解决方案2】:

      我根据from 的指导方针解决了这个问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-30
        • 2019-12-16
        • 1970-01-01
        • 2013-03-22
        • 2011-12-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多