Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

postgres3 async notify mem leak

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Brad Campbell

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
Brad Campbell
to Brad Campbell
Brad Campbell wrote 9 lines
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.

And I'm not, the leak is in the LCL TLabel component. Sorry for the noise.

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