简体   繁体   English

为什么会出现“线程中的异常”AWT-EventQueue-0“java.lang.OutOfMemoryError: Java heap space”错误?

[英]Why does this get “Exception in thread ”AWT-EventQueue-0“ java.lang.OutOfMemoryError: Java heap space” error?

Why do I get a Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space because of objects[i]=rs.getObject(i+1);为什么我Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space得到Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space because of objects[i]=rs.getObject(i+1); ? ? There are about 10,000 records with about 4,000 characters per record.大约有 10,000 条记录,每条记录大约有 4,000 个字符。

        String[] tableColumnsName = {idString, dateEnteredString, entryString, operatorString, licenseNoString, lastModifiedString};
        DefaultTableModel aModel = (DefaultTableModel) logEntryTable.getModel();
        aModel.setColumnIdentifiers(tableColumnsName);

        ResultSetMetaData rsmd;
        try {
            rsmd = rs.getMetaData();

            int colNo = rsmd.getColumnCount();
            while(rs.next()){
                Object[] objects = new Object[colNo];
                for(int i=0;i<colNo;i++){
                    objects[i]=rs.getObject(i+1);
                }
                aModel.addRow(objects);
            }
            logEntryTable.setModel(aModel);

            logEntryTable.getColumnModel().getColumn(0).setMaxWidth(30);

            rs.close();

        } catch (SQLException e) {
            e.printStackTrace();
            showCantConnectErrorDialog();
        }

Your JVM has run out of memory.您的 JVM 内存不足。 Potentially when JVM is short on memory OutOfMemoryError may appear in any place in the code that allocates memory.当 JVM 内存不足时,OutOfMemoryError 可能出现在分配内存的代码中的任何地方。 Try increasing your heap size using -Xmx parameter .尝试使用-Xmx 参数增加堆大小。

我同意 ^^ 您需要增加堆大小,或者如果这不可能,请减少所有内容以尽可能提高空间效率。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何摆脱-“线程“ AWT-EventQueue-0”中的异常java.lang.OutOfMemoryError:Java堆空间”错误? - How to get rid of - “Exception in thread ”AWT-EventQueue-0“ java.lang.OutOfMemoryError: Java heap space” error? 线程“ AWT-EventQueue-0”中的异常java.lang.OutOfMemoryError:Java堆空间 - Exception in thread “AWT-EventQueue-0” java.lang.OutOfMemoryError: Java heap space 如何解决线程“ AWT-EventQueue-0”中的异常java.lang.OutOfMemoryError:Java堆空间 - How to Solve Exception in thread “AWT-EventQueue-0” java.lang.OutOfMemoryError: Java heap space 线程“ AWT-EventQueue-0”中的xception java.lang.OutOfMemoryError:PermGen空间 - xception in thread “AWT-EventQueue-0” java.lang.OutOfMemoryError: PermGen space “ AWT-EventQueue-1” java.lang.OutOfMemoryError:Java堆空间 - “AWT-EventQueue-1” java.lang.OutOfMemoryError: Java heap space 错误:线程“ AWT-EventQueue-0”中的异常java.lang.ClassCastException: - Error :Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: 错误:线程“ AWT-EventQueue-0”中的异常java.lang.NullPointerException - ERROR : Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException 线程“ AWT-EventQueue-0”中的异常java.lang.ArrayIndexOutOfBoundsException:-1错误 - Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: -1 error 线程“ AWT-EventQueue-0”中的异常java.lang.ClassCastException错误 - Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException error 错误“线程“AWT-EventQueue-0”中的异常java.lang.NumberFormatException” - Error "Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM