Re: possible memory leak in Server Status window

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
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:04:01
Message-ID: AANLkTi=uX41pWCFDgCxvo875T1ng2EJTq9DprA1OfcEB@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

On Fri, Feb 11, 2011 at 2:45 PM, Peter Geoghegan
<peter(dot)geoghegan86(at)gmail(dot)com> wrote:
> On 11 February 2011 10:42, Julius Tuskenis <julius(at)nsoft(dot)lt> wrote:
>> Hello, Guillaume
>>
>> Please look at frmStatus::fillLogfileCombo(). Please note, that the set is
>> defined and assigned, but then as it has not enough rows to be "interesting"
>> the function returns 0 and exits. So "delete set;" is never called. Can this
>> be the issue?
>
> Yep, that's a memory leak.
>
> I really think that we should be wrapping pgSet results in a smart
> pointer. wxWidgets 2.9 has a templated smart pointer class. It might
> make sense to look at std::unique_ptr instead, but that might be a
> problem on some more exotic platforms, and we'd have to make autotools
> detect if it was available and possibly error if it wasn't.

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.

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

Exactly.

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

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

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Peter Geoghegan 2011-02-11 15:24:35 Re: possible memory leak in Server Status window
Previous Message Peter Geoghegan 2011-02-11 13:45:54 Re: possible memory leak in Server Status window