Question
· Jul 18, 2017

how to release memory for process?

hi

  I query large mount of rows from one table with JDBC, and will prompt <store> error.  I found that it was out of process memory (default 16M, max 49M in version 2010.2) .

  so my question is : how to release memory for large  mount of rows  query? or how to resolve this error?

Discussion (24)2
Log in or sign up to continue

the query include longvarchar column. when the process memory (bbsize) is  16M by default, I can read about 100,000 rows and then prompt <store> error.  

After I change the process memory to 49M(the max size in version 2010.2), I can read about 300,000 row and then prompt <store> error.

So I need some method to release the memory for process

There is a method $system.Memory.Clean(<cleancache>, <defragment>), but unfortunately it appeared only with version 2011.1.

Try this code (consider that LONGVARCHAR = %Stream.GlobalCharacter) Read a CLOB through JDBC:

try
{
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  Statement st = dbconn.createStatement();
  ResultSet rs = st.executeQuery("Select ID,Text from eprinstance.isegment");
 
  while (rs.next())
  {
    int len;
    Reader reader = rs.getCharacterStream("Text");
    while ((len = reader.read()) != -1)
      bos.write(len);
 
    System.out.println(bos);
 
    reader.close();
    bos.reset();
  }
 
  bos.close();
  st.close();
  rs.close();
 
  System.out.println("OK!");
} finally
{
  dbconn.close();
}

There are a couple of versions that use process private memory for GROUP BY but I don't think Cache 2010.2 is one of them, I was questioning myself as I was typing my first entry.

Looking at your post again you don't say what value you have for process memory.  When working with SQL we strongly recommend that you change this to the max value, 49M.

 

I still would like to see the full error message.

 

Brendan

String sql="Select ID,Text from eprinstance.isegment";
  Statement st = dbconn.createStatement();

  java.sql.ResultSet rs = st.executeQuery(sql);
  
while(  rs.next()){

     String c=rs.getString("Text");
    System.out.println( c);
}

  st.close();
  rs.close();

  dbconn.close();

this is the demo code.   the "Text" column type is longvarchar