Re: Memory leaks
On Wed, 2002-10-23 at 03:09, Tom Lane wrote:
It's fairly difficult to get anywhere with standard leak-tracking tools,
since they don't know anything about palloc. What's worse, it is *not*
a bug for a routine to palloc space it never pfrees, if it knows that
it's palloc'ing in a short-lived memory context. The fact that a
context may be released with much still-allocated memory in it is not a
bug but a feature; but try teaching that to any standard leak checker...
Seems that Valgrind should have no problems with it, as it tracks actual
usage of _memory_ (down to single bits :)) , not malloc/free.
See: http://developer.kde.org/~sewardj/
---------------
Hannu
Import Notes
Reply to msg id not found: 25790.1035324563@sss.pgh.pa.usReference msg id not found: 1035321376.31909.4388.camel@mouse.copelandconsulting.netReference msg id not found: 25790.1035324563@sss.pgh.pa.us
On Tue, Oct 22, 2002 at 04:16:16PM -0500, Greg Copeland wrote:
I've started playing a little with Postgres to determine if there were
memory leaks running around. After some very brief checking, I'm
starting[1] to think that the answer is yes. Has anyone already gone
through a significant effort to locate and eradicate memory leaks? Is
this done periodically? If so, what tools are others using? I'm
currently using dmalloc for my curiosity.
valgrind is a great tool I used -- didn't get the time to try it out on
Postgres yet, though. Besides leaks, it also catches uninitialized
variable access and stuff like that.
Petru
Import Notes
Reply to msg id not found: 1035321376.31909.4388.camel@mouse.copelandconsulting.netReference msg id not found: 1035321376.31909.4388.camel@mouse.copelandconsulting.net | Resolved by subject fallback
Petru Paler <petru@paler.net> writes:
valgrind is a great tool I used -- didn't get the time to try it out on
Postgres yet, though. Besides leaks, it also catches uninitialized
variable access and stuff like that.
I've used Valgrind with PostgreSQL a little bit, and it's been fairly
useful (I used it to fix some memory leaks in psql and pg_dump and a
couple of uninitialized memory accesses in the backend).
If you want to use it on the backend, you'll need to stop postgres
from clobbering ARGV (as this causes valgrind problems, for some
reason) -- add '-DPS_USE_NONE -UPS_USE_CLOBBER_ARGV' to CFLAGS. I
mentioned it to the author of valgrind, but IIRC he didn't mention
any plans to change this behavior.
Cheers,
Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC