[fpc-pascal] postgres3 async notify mem leak

Brad Campbell brad at wasp.net.au
Sat Jun 30 14:58:39 CEST 2007


G'day all,

I'm using Postgres 8.1 and have async notifies working nicely based on select(). The problem is each 
time I get a notify I leak memory. I've commented out the PQfreemem call and find exactly the same 
size leak (tested over 10,000 notifies). I assume from that I'm doing something very wrong but I 
just can't see where. I've been unable to find much in the way of examples out there so I assume I'm 
doing something wrong.

Aside from the memory leak it all works very, very well.
(I'm using this in Lazarus but not using any of the lcl or fcl database components but the postgres3 
unit directly as none of those seem to support PQsocket)

procedure chk_notify;

var
    Notify : PpgNotify;

begin
Notify := PQnotifies(conn);
while Notify <> Nil do
     Begin
       PQfreemem(Notify);
       Inc(queue)
       Notify := PQnotifies(conn);
     End;
end;

Anybody have any ideas?

Regards,
Brad
-- 
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams



More information about the fpc-pascal mailing list