Re: free(3)-ing variables in pg_dump

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: free(3)-ing variables in pg_dump
Дата
Msg-id 3F7057CF.5020902@dunslane.net
обсуждение исходный текст
Ответ на free(3)-ing variables in pg_dump  (Andreas Joseph Krogh <andreak@officenet.no>)
Ответы Re: free(3)-ing variables in pg_dump  (Andreas Joseph Krogh <andreak@officenet.no>)
Список pgsql-hackers
Andreas Joseph Krogh wrote:

>Hi.
>
>I'm trying to implement functionallity to dump multiple tables with multiple 
>"-t <table-name>" options. 
>
excellent.

>While digging in the source for pg_dump I see that 
>many local static variables are not freed( with free(3)). Is this lazy 
>programming because pg_dump is its own process  where the kernel takes care 
>of cleaning up, so you don't bother to do it for some of the variables? I'm 
>malloc'ing some structs to build a list over tables which are marked for 
>dumping. Shall I bother to free(3) them?
>
>  
>
I don't think it's lazy, probably just a product of the programmer's 
awareness that little would be gained by it. Relying on the OS to clean 
up for you is perfectly valid in a shortlived program unless you get a 
major problem with memory leaks.

"If it ain't broke, don't fix it" would be my take.

(If this is not the consensus I'm going to have some more work to do in 
the C port of initdb I'm working on, which is about one third done :-)

cheers

andrew



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zhen Yang
Дата:
Сообщение: Question on adding new indexes to Postgresql
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: free(3)-ing variables in pg_dump