Note that there are some explanatory texts on larger screens.

plurals
  1. POOutOfMemoryError: Java heap space
    primarykey
    data
    text
    <p>I'm having a problem with a java OutOfMemoryError. The program basically looks at mysql tables that are running on mysql workbench, and queries them to get out certain information, and then puts them in CSV files. </p> <p>The program works just fine with a smaller data set, but once I use a larger data set (hours of logging information as opposed to perhaps 40 minutes) I get this error, which to me says that the problem comes from having a huge data set and the information not being handled too well by the program. Or it not being possible to handle this amount of data in the way that I have.</p> <p>Setting Java VM arguments to -xmx1024m worked for a slightly larger data set but i need it to handle even bigger ones but it gives the error.</p> <p>Here is the method which I am quite sure is the cause of the program somewhere:</p> <pre><code>// CSV is csvwriter (external lib), sment are Statements, rs is a ResultSet public void pidsforlog() throws IOException { String[] procs; int count = 0; String temp = ""; System.out.println("Commence getting PID's out of Log"); try { sment = con.createStatement(); sment2 = con.createStatement(); String query1a = "SELECT * FROM log, cpuinfo, memoryinfo"; rs = sment.executeQuery(query1a); procs = new String[countThrough(rs)]; // SIMPLY GETS UNIQUE PROCESSES OUT OF TABLES AND STORES IN ARRAY while (rs.next()) { temp = rs.getString("Process"); if(Arrays.asList(procs).contains(temp)) { } else { procs[count] = temp; count++; } } // BELIEVE THE PROBLEM LIES BELOW HERE. SIZE OF THE RESULTSET TOO BIG? for(int i = 0; i &lt; procs.length; i++) { if(procs[i] == null) { } else { String query = "SELECT DISTINCT * FROM log, cpuinfo, memoryinfo WHERE log.Process = " + "'" + procs[i] + "'" + " AND cpuinfo.Process = " + "'" + procs[i] + "'" + " AND memoryinfo.Process = " + "'" + procs[i] + "' AND log.Timestamp = cpuinfo.Timestamp = memoryinfo.Timestamp"; System.out.println(query); rs = sment.executeQuery(query); writer = new CSVWriter(new FileWriter(procs[i] + ".csv"), ','); writer.writeAll(rs, true); writer.flush(); } } writer.close(); } catch (SQLException e) { notify("Error pidslog", e); } }; // end of method </code></pre> <p>Please feel free to ask if you want source code or more information as I'm desperate to get this fixed!</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload