[英]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.