Re: BUG #4496: Memory leak in pg_dump.c?

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Aggro <dvice_null(at)yahoo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4496: Memory leak in pg_dump.c?
Date: 2008-10-31 11:18:36
Message-ID: 490AE98C.2060709@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Aggro napsal(a):
>> I think all information is collected and they are
>> used for all pg_dump run. It
>> does not make sense to free them. See line 725.
>>
>> Zdenek
>
> But is the memory freed at some point? E.g. when
> program shuts down? If it is not freed ever, then it
> is a memory leak. I'm interested in this, because
> either you have a memory leak or these is a bug in
> another application called cppcheck which claims that
> you have a memory leak. But if it is too difficult to
> find out, I won't bother you about this anymore as it
> is most likely a minor issue if even that.

Keep in mind that onetime allocated local memory is not reclaimed to OS until
process finished. See sbrk(2) It does not make sense to free memory at the end
(in pg_dump) because it does not have any effect on available memory in OS and
OS clean it soon anyway. I agree that from general point of view it is good to
release unused memory, because process can reuse it. But when you know what you
do then you can break a rule.

Zdenek

--
Zdenek Kotala Sun Microsystems
Prague, Czech Republic http://sun.com/postgresql

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Zdenek Kotala 2008-10-31 11:20:56 Re: BUG #4494: Memory leak in pg_regress.c
Previous Message Gabriele Bartolini 2008-10-31 08:26:48 Docbook DSSSL Stylesheets link is broken