Re: Memory leaks

From: Greg Copeland <greg(at)CopelandConsulting(dot)Net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgresSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory leaks
Date: 2002-10-23 13:33:13
Message-ID: 1035379994.31912.5395.camel@mouse.copelandconsulting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2002-10-22 at 22:28, Tom Lane wrote:
> Greg Copeland <greg(at)copelandconsulting(dot)net> writes:
> >So again, I'm not really sure it they are meaningful at
> > this point.
>
> psql might well have some internal leaks; the backend memory-context
> design doesn't apply to it.

Okay. Thanks. I'll probably take another look at it a little later and
report back if I find anything of value.

> >Does that mean they are not using
> > palloc/pfree stuff?
>
> Not everywhere. plpgsql is full of malloc's and I think the other PL
> modules are too --- and that's not to mention the allocation policies of
> the perl, tcl, etc, language interpreters. We could use a thorough
> review of that whole area.
>

Okay. I've started looking at plpython to better understand it's memory
needs. I'm seeing a mix of mallocs and PLy_malloc. The PLy version is
basically malloc which also checks and reports on memory allocation
errors. Anyone know if the cases where malloc was used was purposely
done so for performance reasons or simply the flavor or the day?

I thinking for starters, the plpython module could be normalized to use
the PLy_malloc stuff across the board. Then again, I still need to
spend some more time on it. ;)

> > Well, the thing that really got my attention is that dmalloc is
> > reporting frees on null pointers.
>
> AFAIK that would dump core on many platforms (it sure does here...),
> so I don't think I believe it without seeing chapter and verse.

I actually expected it to do that here on my x86-Linux platform but a
quick check showed that it was quiet happy with it. What platforms are
you using -- just curious?

> But if you can point out where it's really happening, then we must fix it.
>

I'll trying track this down some more this coming week to see if this is
really occurring. After thinking about it, I'm not sure why dmalloc
would ever report a free on null if it were not actually occurring.
After all, any call to free should still be showing some memory address
(valid or otherwise). Off the top of my head, I can't think of an
artifact that would cause it to falsely report it.

Greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-10-23 13:39:47 Re: Memory leaks
Previous Message Nigel J. Andrews 2002-10-23 11:44:09 Re: Memory leaks