java - Memory leak in JDBC4Connection -


i'm trying catch memory leak in 1 of our java daemons, , after dumping memory , analyzing via memory analyzer tool, noticed of leak caused jdbc4connection:

10 instances of "com.mysql.jdbc.jdbc4connection", loaded "sun.misc.launcher$appclassloader @ 0x2aaab620ed00" occupy 858,283,752 (81.55%) bytes. biggest instances:  * com.mysql.jdbc.jdbc4connection @ 0x2aaab64ad820 - 87,110,160 (8.28%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab64af520 - 86,730,408 (8.24%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab64ad0e0 - 86,584,048 (8.23%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab64aede0 - 86,488,800 (8.22%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab61f5320 - 85,752,872 (8.15%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab64ae6a0 - 85,603,280 (8.13%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab64adf60 - 85,270,440 (8.10%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab61f4be0 - 85,248,592 (8.10%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab64afc60 - 85,120,704 (8.09%) bytes. * com.mysql.jdbc.jdbc4connection @ 0x2aaab61f5a60 - 84,374,448 (8.02%) bytes.  keywords com.mysql.jdbc.jdbc4connection sun.misc.launcher$appclassloader @ 0x2aaab620ed00 

i'm pretty sure closing of mysql resources, can't quite find causing this.

is there way catch it? have experienced in past, , can advise should for?

p.s.: looking deeper mat, see following info:

com.mysql.jdbc.jdbc4connection @ 0x2aaab64ad820 | 1,856 | 87,110,160 | 8.28% |- java.util.hashmap @ 0x2aaab62115a8 | 64 | 87,021,632 | 8.27% | '- java.util.hashmap$entry[16384] @ 0x2aaae182e970| 131,096 | 87,021,568 | 8.27%

it seems each jdbc holds huge amount of hashmap entries (>6000 objects), , not free them @ all.

thanks in advance!

duffymo right. in past when we've had memory leaks, it's practically mysql jdbc driver. forgetting close 1 little resultset or connection or statement somewhere. ended auditing entire codebase every time used find problem , ensure closed.

as hashmap, i've seen too. haven't looked @ source impression mysql driver stored rows (at least row values) in hashmaps internally.

leaking resultsets sadly easy. idea of closeable resources take care of coming in jdk 7 or 8 appeals me reason.

you insert shim class somewhere (say connection) log each opened/closed resource see if can catch leak without directly reading source.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -