I recently noticed (via jmap+jhat) that my App was leaking storing many instances com.mysql.jdbc.Field
class
- I double checked my code to make sure I was closing all PreparedStatements, find a few missing but it didn't change the outcome.
- Some PreparedStatement are created and closed right away
- Several others are created at start up and reused many times
- I am using org.apache.tomcat.jdbc.pool.DataSource
as connection pool
What can cause this type of behavior?
Tell me more
×
Stack Overflow is a question and answer site for
professional and enthusiast programmers. It's 100% free, no registration required.
|
|||
|
Are you closing all of your preparedstatements / result sets using:
So that you guarantee all result sets are closed when finished (regardless of exceptions) and all statements are closed (regardless of exceptions)? Obviously there are other ways to write that, but the idea is the same. If you're doing all of that properly, then unless you have so many references that it's taking up an inordinate amount of memory, it's almost certainly OK and nothing needs to be done about it. |
|||
|