From: | lucas at mcsnw(dot)com (Lucas Madar) |
---|---|
To: | |
Subject: | [Pljava-dev] Proper use of ResultSetHandle and related memory leaks |
Date: | 2009-08-18 17:27:53 |
Message-ID: | 4A8AE499.4040901@mcsnw.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
Hello,
I have a pl/java routine that does some complex calculations based on
database information, inserts it into another database table, and then
essentially does a select on itself to return a resultSet:
public ResultSet getResultSet() throws SQLException {
if(resid != null) {
statement =
DriverManager.getConnection("jdbc:default:connection").createStatement();
return statement.executeQuery("SELECT * FROM tblResult
WHERE ResultID = '" + resid + "'");
}
return null;
}
(resid is a class member variable, a UUID, and everything works fine).
However, executing this nearly 1,000 times in an open session leads to
the postgres instance growing to nearly 1gb in memory usage. Clearly,
there is a memory leak somewhere, but I would think that the ResultSet
and its open connections would be gc'd once the class instance was no
longer used.
So, I recoded the above to use a CachedResultSet, closed the connection
and statement, and the memory leak still persists. Is there a proper way
to use this that I'm not envisioning? Or have I run into a bug?
Thanks,
Lucas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20090818/9a44483e/attachment.html>
From | Date | Subject | |
---|---|---|---|
Next Message | Jatinder Sangha | 2009-09-03 15:23:23 | [Pljava-dev] PLJava SIGSEGV on Linux |
Previous Message | Gabriel Holmes | 2009-07-30 03:23:18 | [Pljava-dev] Hi all |