PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch - Mailing list pgadmin-hackers

From efesar
Subject PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch
Date
Msg-id NGBBKFMOILMAGDABPFEGEEOIDMAA.efesar@nmia.com
Whole thread Raw
In response to Re: PGAdmin 3 Patch  ("Dave Page" <dpage@vale-housing.co.uk>)
List pgadmin-hackers
Dave,

Nevermind that last patch if you haven't patched it yet.

I got seriously bored of looking at memory leaks in VCC so I went through
and patched all the memory leaks that I could find. Also, there are a couple
of updates on the Query Builder.

Here is a synopsis of changes:

* Drag/Drop functionality in the Query Builer is not functional yet, so use
double clicks/context menus instead. Most of the context/double clicks
actually work in the child windows and in the add table/view window.
* Added and ExecuteSet to pgDatabase (cloned from pgServer), because using
the one from pgServer was choosing random connections/databases.
* pgServer::ExecuteSet (and pgDatabase::ExecuteSet) now returns a pointer
instead of a reference and has to be deleted when you're done with it (this
was the major source of memory leaks because you were converting the pointer
into a reference, ergo the references were being deleted, but not the
objects themselves)
* pgSet::ColName -- column names in PQfname are zero based, not one baseed,
so I had changed "col+1" to "col" for consistency. This might also be true
of PQfsize, but I didn't check.
* Deleted the logger in application OnExit because it was causing memory
leaks.
* Converted all context menus and the image lists to members of frmMain
because they weren't being deleted. Also, deleted them in the destructor
(fixing memory leaks in the process).
* In the application OnInit, syssettings was calling a log function before
the logger was initialized, and the logger requires syssettings, therefore
it was causing a memory leak. I had to delete the log entry from syssettings
OnInit to prevent memory leak (it wasn't being logged anyway).
* frmConnect - it's a modal form, so I turned it into a reference instead of
a pointer to prevent memory leaks  and also so that you don't have to call
destroy or delete. I think it's called in pgConn::OnConnect().
* frmConnect - it's now returning IDOK and IDCANCEL to be more visible.

As a side note, I figured out the problem with caching. I can't cache
anything yet because the database objects aren't loaded in the treeview
(there's no functionality for that yet). So for now, to make the Query
Builder functional, I must use raw SQL calls. However, I will build it with
the idea in mind that later we will take info from the cache (whatever it's
architecture happens to be).

As usual, I think you can ignore the project file. Just make sure to add the
new cpp/h files in the appropriate places.

-Keith

Attachment

pgadmin-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: idea error Handler
Next
From: "Dave Page"
Date:
Subject: Re: PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch