pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Lewis <mark.lewis@mir3.com>
To: Albe Laurenz <all@adv.magwien.gv.at>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Memory leak in 8.0 JDBC driver?
Date: Thu, 11 Aug 2005 10:55:04 -0700
Message-ID: <1123782905.14573.123.camel@archimedes> (raw)
In-Reply-To: <52EF20B2E3209443BC37736D00C3C1380422A3A0@EXADV1.host.magwien.gv.at>
References: <52EF20B2E3209443BC37736D00C3C1380422A3A0@EXADV1.host.magwien.gv.at>

There are several great commercial products to track down Java memory
leaks (I can recommend YourKit).  There's also an open-source profiler
called JMP (http://www.khelekore.org/jmp/) that also has some memory
profiling capabilities.

(Actually, it didn't used to, but I mentioned to the maintainer that it
would be a great feature to add, and so he did.  Very responsive guy).

JMP isn't as polished and doesn't make it quite as easy to track down
elusive leaks, but still works pretty well.

Besides using a memory profiler, you should also check to make sure that
ResultSet and Statement objects are always closed.  Some drivers may not
leak memory if you forget to close those, but some will.  Not sure which
camp PostgreSQL falls in, but it might explain the different behavior
when testing different DB's.

-- Mark

On Thu, 2005-08-11 at 19:07 +0200, Albe Laurenz wrote:
> Before I file a bug, I'd like to ask if the problem is known or if I
> have done anything wrong.
> 
> I am running a database stress test against a PostgreSQL 8.0.3 database
> on a Linux machine.
> The test program runs on a Windows 2000 client via JDBC, it starts
> several threads, each
> of which opens a database connection and issues random statements
> against the database
> until the program is interrupted.
> 
> After about 2 hours, the program always dies with an OutOfMemoryError.
> 
> I have tried both JRE 1.4.2_02 and 1.5.0_04 from Sun.
> I would suspect a programming error on my side, except the same program
> on the same machine
> runs for days without problems if I run it against other databases
> (Derby, Firebird, MySql,
> Oracle, MaxDB).
> 
> I have got the JDBC3 driver 8.0 Build 312 from
> http://jdbc.postgresql.org/download.html,
> and I have also tried downloading and building from source.
> No matter what I do, memory runs out.
> 
> - Should I report this as a bug?
> - I did not want to spam the list with the source of my test program,
> but I'd happily do
>   so if you think it would help.
> - Do you have any hints as to how I could debug the problem myself? Can
> you recommend a
>   memory profiler?
> 
> Thank you,
> Laurenz Albe
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster




view thread (10+ messages)  latest in thread

Message-ID: <1123782905.14573.123.camel@archimedes>
Permalink:  ../1123782905.14573.123.camel@archimedes/
Also on:    postgresql.org/message-id/1123782905.14573.123.camel@archimedes

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mark.lewis@mir3.com, all@adv.magwien.gv.at
  Subject: Re: Memory leak in 8.0 JDBC driver?
  In-Reply-To: <1123782905.14573.123.camel@archimedes>
  References: <52EF20B2E3209443BC37736D00C3C1380422A3A0@EXADV1.host.magwien.gv.at> <1123782905.14573.123.camel@archimedes>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox