Re: possible memory leak in Server Status window

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Julius Tuskenis <julius(at)nsoft(dot)lt>, pgadmin-support(at)postgresql(dot)org
Subject: Re: possible memory leak in Server Status window
Date: 2011-02-11 15:24:35
Message-ID: AANLkTi=0LFEfy-Au0fNnNfmR6ktxHEmWPCDC7+RonYeR@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

On 11 February 2011 15:04, Dave Page <dpage(at)pgadmin(dot)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

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Guillaume Lelarge 2011-02-12 08:23:52 Re: possible memory leak in Server Status window
Previous Message Dave Page 2011-02-11 15:04:01 Re: possible memory leak in Server Status window