Skip site navigation (1) Skip section navigation (2)

PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch

From: efesar <efesar(at)nmia(dot)com>
To: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>,Pgadmin-Hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch
Date: 2003-03-06 05:51:27
Message-ID: NGBBKFMOILMAGDABPFEGEEOIDMAA.efesar@nmia.com (view raw or flat)
Thread:
Lists: 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: pgadmin3.keith.2003.03.zip
Description: application/x-zip-compressed (22.1 KB)

In response to

pgadmin-hackers by date

Next:From: Dave PageDate: 2003-03-06 09:18:40
Subject: Re: PGAdmin 3 Patch // Memory Leaks Fixed // Ignore last patch
Previous:From: Dave PageDate: 2003-03-05 21:45:41
Subject: Re: idea error Handler

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group