Try doing that in reverse order:
rs.close();
rs = null;
stmnt.close();
stmnt = null;
conn.close();
conn = null;
I usual do one more step also, just to be safe.
try {rs.close();} catch (Exception ignore) {}
rs = null;
try {stmnt.close();} catch (Exception ignore) {}
stmnt = null;
try {conn.close();} catch (Exception ignore) {}
conn = null;
On 8/3/05, Jan Philipp Seng <[EMAIL PROTECTED]> wrote:
> > : 2) I don't see the code to close your statement, connection, and
> > : ResultSet. Those typically go to a finally block.
> >
> > I'm 85% sure that's the memory leak right there... in absence of a
> > good memory profiler, have you tried commenting out all of the Lucene
> > related code, to make sure that your basic DB Data retrieval code doesn't
> > leak memory?
> >
> > i'm guessing that without the Lucene code, it won't run out of RAM as fast
> > (because their won't be a RAMDirectory index taking up space) but you
> > should still see your free memory steadily decrease.
>
> Thank you Hoos,
>
> I left some of my code out to make it compact. There is a finally-block that
> does rigth this.
> But you are completely rigth. I commented out all Lucene related code and
> the free memory decreases every indexing run. I close the connection, but
> this does not free the memory. Do you have another hint for me what I can do
> against the memory leak in the connector to the mySQL-database? I am using
> mysql-connector-java-3.1.10-bin.jar.
>
> Constructor: inits the members:
> Connection conn
> Statement stmt
> ResultSet rs
> finally block:
> conn.close();
> conn = null;
> stmt.close();
> stmt = null;
> rs.close();
> rs = null;
>
> Bye for now.
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]