commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] [Closed] (DBCP-330) Calling getMetaData() without closing the connection lead to a memory leak
Date Tue, 24 Feb 2015 03:23:21 GMT


Phil Steitz closed DBCP-330.

> 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 was sent by Atlassian JIRA

View raw message