commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothee Maret (JIRA)" <>
Subject [jira] Commented: (DBCP-330) Calling getMetaData() without closing the connection lead to a memory leak
Date Tue, 15 Feb 2011 09:06:57 GMT


Timothee Maret commented on DBCP-330:

Hi, I have successfully tested the patch on my setup. I have monitored the memory consumption
with jprofiler, the DelegatingDatabaseMetaData objects get properly garbage collected. thanks!

> Calling getMetaData() without closing the connection lead to a memory leak
> --------------------------------------------------------------------------
>                 Key: DBCP-330
>                 URL:
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Linux Mint 8 Helena - Universal Edition
> Linux version 2.6.31-14-generic (buildd@rothera) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8)
) #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009
> java version "1.6.0_15"
> Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
> Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)
>            Reporter: Timothee Maret
>            Priority: Minor
>             Fix For: 1.4.1
> In my program, I am using a BasicDataSource to get my database connections. I have to
keep one of the connection alive and thus never close it. On this connection, I have to periodically
get the metadata (call the getMetaData() method) for my processing.
> However, I have noticed that each call to this method create a new DelegatingDatabaseMetaData
instance which can't be garbage collected until the connection is closed. This creation of
DelegatingDatabaseMetaData will finally consume all the memory and generate a OutOfMemory
> Actually, in it's constructor, the DelegatingDatabaseMetaData class calls its super constructor
(from the AbandonedTrace class) which creates a reference (parent.addTrace(this);) from the
connection to the DelegatingDatabaseMetaData. This reference prevent the DelegatingDatabaseMetaData
to be collected until the Connection is closed.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message