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 AANLkTinQkSz7qx-N=GP6+G2X=xv=prEFkNQ0S+Eq=7LX@mail.gmail.com
Whole thread Raw
In response to Re: possible memory leak in Server Status window  (Julius Tuskenis <julius@nsoft.lt>)
Responses Re: possible memory leak in Server Status window  (Dave Page <dpage@pgadmin.org>)
List pgadmin-support
On 11 February 2011 10:42, Julius Tuskenis <julius@nsoft.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.

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

-- 
Regards,
Peter Geoghegan


pgadmin-support by date:

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