Re: Detecting memory leaks with libpq?

Поиск
Список
Период
Сортировка
От Antonio Vieiro
Тема Re: Detecting memory leaks with libpq?
Дата
Msg-id CAPHN3JV+eOub0VVOC0KM-Hv6nGBq6SW-FP8bimzGho=5mXWt6Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Detecting memory leaks with libpq?  (Ben Chobot <bench@silentmedia.com>)
Список pgsql-general
Hi all,

Well, thanks for the ideas. I also prefer cleaning things up myself
before exiting.

I was expecting some small statistics from the library (connections
opened/closed, PGresults returned/freed, etc.) but I can do it myself,
before trying out  more heavyweight tools such as valgrind.

Cheers,
Antonio

2011/7/19 Ben Chobot <bench@silentmedia.com>:
> On Jul 19, 2011, at 6:28 AM, Craig Ringer wrote:
>
>> Note that some "leaks" that are reported are _normal_ in most software. There is absolutely no harm in not free()ing
astructure that's allocated only once during init and never messed with afterwards. The OS clears the memory anyway, so
free()ingit is just a waste of CPU cycles. 
>
> Getting off topic here but "normal" isn't always "desirable." Some might say that allocating singletons and never
freeingthem - even after they're no longer valid - is just sloppy code. By the same logic, dangling pointers are A-OK,
solong as you never use them. So yes, it might be an extra cycle or two to free it now, but that's a cycle or two the
OSwon't have to do later, and it's almost certainly better to have a cleaner codebase that's 0.000001% slower. 
>
> Or so some might argue. :)

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

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: timezone help?
Следующее
От: Chris Travers
Дата:
Сообщение: Question on utility statements and parameterization