Re: possible memory leak in Server Status window

Поиск
Список
Период
Сортировка
От Dave Page
Тема Re: possible memory leak in Server Status window
Дата
Msg-id AANLkTikTGsF2gL434uCAiD_YO8ZDUeXA-SMnraJF2a86@mail.gmail.com
обсуждение исходный текст
Ответ на Re: possible memory leak in Server Status window  (Guillaume Lelarge <guillaume@lelarge.info>)
Ответы Re: possible memory leak in Server Status window  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
Re: possible memory leak in Server Status window  (Guillaume Lelarge <guillaume@lelarge.info>)
Список pgadmin-support
On Sat, Feb 12, 2011 at 9:23 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> I know Peter and Dave talked about some stuff I actually didn't
> understand, but it seems it would take some time to do. So, I prefer
> having this simple and effective fix right now :)

:-)

We were talking about smart pointers - basically, instead of doing
something like:

obj *foo = new obj();
...
<many lines of code and exit points>
...
delete foo;

You might do:

pg_smartptr<obj> foo;
...
<many lines of code and exit points>
...

Note the lack of a delete - that's the point here; it's not needed
because as soon as the smart pointer goes out of scope, it's
destructor will delete foo. That means you don't have to remember to
include the delete in each of the many exit points of the code.

See also http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: Vladimir Kokovic
Дата:
Сообщение: Enpty field, grid editor, NOT NULL
Следующее
От: Dave Page
Дата:
Сообщение: Re: Enpty field, grid editor, NOT NULL