Re: possible memory leak in Server Status window - Mailing list pgadmin-support

From Peter Geoghegan
Subject Re: possible memory leak in Server Status window
Date
Msg-id AANLkTi=0LFEfy-Au0fNnNfmR6ktxHEmWPCDC7+RonYeR@mail.gmail.com
Whole thread Raw
In response to Re: possible memory leak in Server Status window  (Dave Page <dpage@pgadmin.org>)
List pgadmin-support
On 11 February 2011 15:04, Dave Page <dpage@pgadmin.org> wrote:

> Ashesh had some code to implement a smart pointer a while back. I
> suggested he post it here, but I know he's been too busy to do much
> else with it.container

I would prefer to use a stdlib smart ptr, or a well tested third party
smart ptr that we can adopt ourselves. std::auto_ptr has been in the
standard for a long time, so it really isn't that unreasonable to
expect it to be on supported platforms. It is totally no-throwing. On
the other hand, it will soon be deprecated. There are lots of
subtleties to writing a smart pointer class. I seem to recall Scott
Meyers complaining about the amount of errata he had to write when he
rolled his own smart pointer class for either the first or second
edition of Effective C++. Granted, that probably had plenty to do with
exception safety and exception neutrality, which we basically don't
have to worry about, but I think some of the same concerns still
apply.

>> Alternatively we could abandon pointer semantics and write our own
>> RAII wrapper class. This would be a large patch.
>
> Exactly.

It also has the disadvantage of there being no reasonable way to avoid
a deep copy when returning from a function without using C++0x's
rvalue references.

-- 
Regards,
Peter Geoghegan


pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: possible memory leak in Server Status window
Next
From: Guillaume Lelarge
Date:
Subject: Re: possible memory leak in Server Status window