Note that there are some explanatory texts on larger screens.

plurals
  1. POOut of memory exception in my code
    text
    copied!<p>I am running a code for long hours as part of a stress test on an Oracle db and using java version "1.4.2". In a nutshell, what I am doing is :</p> <pre><code>while(true) { Allocating some memory as a blob byte[] data = new byte[1000]; stmt = fConnection.prepareStatement(query); // [compiling an insert query which uses the above blob] stmt.execute(); // I insert this blob-row in the database. stmt.close(); } </code></pre> <p>Now I want to run this test for 8-10 hrs. However apparently after inserting about 15million records I hit the <strong>java.lang.OutOfMemoryError</strong></p> <p>I am running this with -Xms512m -Xmx2g . I tried using higher values but I dont seem to have that much hardware neither do I think it is req:</p> <pre><code> java -Xms512m -Xmx4g -jar XX.jar Invalid maximum heap size: -Xmx4g The specified size exceeds the maximum representable size. Could not create the Java virtual machine. java -Xms2g -Xmx3g -jar XX.jar Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. </code></pre> <p>I run this as a multithreaded program. So arnd 10 threads are doing the inserts.</p> <p>Is there any way I can get around this program in possibly no-hack manner. I mean what if I decide to run this for 15-20 hrs instead of 8-10 hrs. </p> <p>EDIT: added stmt.close since I am using that in my code already. some changes based on comments</p> <p>Thanks</p> <p>P.S: sorry cant post the code bec of NDA</p>
 

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