Board index » delphi » Virtual memory leak in Indy

Virtual memory leak in Indy

I've tried submitting this to the bug list at but it's not working.  It says
there's some sort of socket error (!!!!).

TIdTCPConnection.WriteBuffer seems to be the cause of a virtual memory leak
if a null byte is sent through it.

void __fastcall TSimpleThread::Write(AnsiString Msg)
    char    Terminator = 0;

    // Client is a TIdTCPClient pointer

    try {
        Client->WriteBuffer(&Terminator, 1 , true);
    catch(...) {
        // socket probably disconnected


Memproof shows the virtual memory rising and rising until after several days
there isn't much left :)
There is no resource leak at all if I don't send a 0 byte.  I've tried:

Client->WriteBuffer(&Terminator, 1 , true); (where Terminator is a 0 byte)
and Client->Write(CHAR0);
and Client->Write(Msg + CHAR0);


Re:Virtual memory leak in Indy

Oops... I'm totally wrong.  That 0 is triggering a response from the server
which then gets put through the OpenXML parser.  It looks like the XTML
parser has the memory leak.


Other Threads