title: OutOfMemoryError GC overhead limit exceeded for java jdbc preparedStatement
body: <p>I'm writing a tool used for transferring the data from old schema to new schema in oracle database.</p>
  
  <p>There are about twenty tables in my database. Only two of them are big, they may have four million records. Others are small ( maybe ten thousands or one hundred thousand).</p>
  
  <p>Now I use one thread to process all small tables in serially, and divide big table into pieces, create some thread, and use one thread process one piece, every piece is one million record.</p>
  
  <p>Now I have some problems. When I start the program, every is ok. But when my program run after a period of time, I will get some error info:</p>
  
  <pre><code>Exception in thread "Thread-8" java.lang.OutOfMemoryError: GC overhead limit exceeded
  at oracle.jdbc.driver.OracleBlobInputStream.needBytes(OracleBlobInputStream.java:168)
  at oracle.jdbc.driver.OracleBufferedStream.readInternal(OracleBufferedStream.java:178)
  at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:147)
  at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:137)
  at oracle.jdbc.driver.BlobAccessor.getBytes(BlobAccessor.java:249)
  at oracle.jdbc.driver.OracleResultSetImpl.getBytes(OracleResultSetImpl.java:714)
  at oracle.jdbc.driver.OracleResultSet.getBytes(OracleResultSet.java:1625)
  at datatransfer.processor.CProcessor.write(CProcessor.java:111)
  at datatransfer.processor.Processor.process(Processor.java:77)
  at datatransfer.thread.CThread.run(CThread.java:37)
  </code></pre>
  
  <p>I have checked my program, there is no closed loop, and I really close <code>statement</code> and <code>resultset</code>.</p>
  
  <p>Every <code>Thread</code> has its own <code>Connection</code>.</p>
  
  <p>How can I check the reason why my program cost memory? And is there any way to solve this problem?</p>
  
  <pre><code>    ResultSet rs = statement.executeQuery(sql);
      int count = 0;
      long start = System.currentTimeMillis();
      while(rsSrc.next()){
          preStatement.setString(1, rsSrc.getString(1)); 
          preStatement.setString(2, rsSrc.getString(2)); 
          preStatement.setString(3, rsSrc.getString(3)); 
          preStatement.setString(4, rsSrc.getString(4)); 
          preStatement.setString(5, rsSrc.getString(5)); 
          preStatement.setString(6, rsSrc.getString(6)); 
          preStatement.addBatch();
          count++;
          if (count % batchSize == 0){
              preStatement.executeBatch();
              preStatement.clearBatch();
  
          }
      }
      preStatement.executeBatch();
      preStatement.clearBatch();
      writeConn.commit();
      long end = System.currentTimeMillis();
  </code></pre>
  
  <p><code>statement</code> and <code>preStatement</code> are created by different <code>Connection</code>, one is old schema, the other is new schema.</p>
  
  <p>Is there something wrong in my code?</p>