Re: BUG #4496: Memory leak in pg_dump.c? - Mailing list pgsql-bugs

From Zdenek Kotala
Subject Re: BUG #4496: Memory leak in pg_dump.c?
Date
Msg-id 490AE98C.2060709@sun.com
Whole thread Raw
In response to Re: BUG #4496: Memory leak in pg_dump.c?  (Aggro <dvice_null@yahoo.com>)
List 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

pgsql-bugs by date:

Previous
From: Gabriele Bartolini
Date:
Subject: Docbook DSSSL Stylesheets link is broken
Next
From: Zdenek Kotala
Date:
Subject: Re: BUG #4494: Memory leak in pg_regress.c