Re: possible memory leak??

From: Jens Carlberg <jenca(at)lysator(dot)liu(dot)se>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: possible memory leak??
Date: 2002-11-08 17:49:46
Message-ID: 3DCBF93A.4040506@lysator.liu.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Michael Paesold wrote:
> Dave Cramer <Dave(at)micro-automation(dot)net> wrote:
>
>
>>Should the gc run before an OutOfMemoryException is thrown
>>
>>in other words are the jvm's smart enough to run the gc if they are out
>>of memory?
>
>
> Yes, the jvm should be smart enough to regain unused memory before throwing
> an OutOfMemoryException. The global gc runs in the backround in defined
> intervals, but more often in low memory situations, as far as I know.

From the documentation of the OutOfMemoryError:

"Thrown when the Java Virtual Machine cannot allocate an object because
it is out of memory, and no more memory could be made available by the
garbage collector. "

Thus, the VM tries to get the memory needed through a garbage collection
before it gives up and throws an error.

<snip>
> Does the overall memory consumption increase, even with System.gc() called
> explicitly? Have you tried running it until the jvm needs more than maximum
> allowed memory? (the limit can be set with command line arguments)

Also, add the flag -verbose:gc to java to see the actual garbage
collection taking place. If you combine that with adding a System.gc()
you'll probably end up with enough debug info.

--
_/ _/_/_/ _/ _/ _/_/_/ | Jens Carlberg
_/ _/ _/_/ _/ _/ | jenca(at)lysator(dot)liu(dot)se
_/ _/_/ _/ _/_/ _/ | +46 13 260872
_/_/ _/_/_/ _/ _/ _/_/_/ | ICQ: 44194995

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-11-08 18:12:32 Re: DatabaseMetaData.getTables problem
Previous Message Michael Stephenson 2002-11-08 17:29:24 Retrieving foreign key information via jdbc