--- On Fri, 5/28/10, Christopher Schultz <[email protected]> wrote:
> Problem #2:
>
>> I noticed another message in intellij complaianing that a mysql
>> connecton was not closed but was closed by the container to prevent a
>> memory leak. I have look everywhere in code and have closed the
>> connection in a finally block ehrnever it has been opened. Any idea
>> where I should close this connection? I am using hibernate btw.
>
> Search your code for "DriverManager" or "getConnection".
>
> Can you post the log message that you get? Can you post a sanitized
> sample of your JDBC code so we can see it?
A couple of things here. You've posted a section of your Hibernate code in the
past, and I had commented that you really need to surround your connections
with try / catch / finally.
Someone (Chris or Chuck) has posted boilerplate code on the list recently in
answer to another question that demonstrates a good template.
You'll also want to be at the latest release of the MySQL JDBC connector. There
are some permgen memory leaks fixed in 5.1.11, and the latest release is 5.1.12
(5.1.11 is not available for download). In particular, 5.1.11 fixes:
- Fixed Bug#36565 - permgen leak from java.util.Timer. Unfortunately no
great fix exists that lets us keep the timer shared amongst connection
instances, so
instead it's lazily created if need be per-instance, and torn down when
the
connection is closed.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]