Re: Memory Leak in TIdSMTP

Giganews Newsgroups
Subject: Re: Memory Leak in TIdSMTP
Posted by:  Holger Dors (do…@kittelberger.de)
Date: Thu, 01 Jun 2006

Thomas Zangl schrieb:

> I noticed a memory leak in TIdSMTP:
> (Testcase: Sending a simple email, no attachments, single recipient)
>[...]
> Leak #0 Instance of TIdSMTPEnhancedCode
> [...]
> Leak #1 Instance of TIdSMTPEnhancedCode

Helmut Steinberger posted the following solution in the
Indy-Dev-Public-List, on 28.03.2006: in IdReplySMTP change the following

constructor TIdReplySMTP.Create(ACollection: TCollection);
begin
    inherited Create(ACollection);
    FEnhancedCode := TIdSMTPEnhancedCode.Create;
end;

constructor TIdReplySMTP.Create( ACollection: TCollection;
AReplyTexts: TIdReplies );
begin
    inherited Create(ACollection, AReplyTexts);
    FEnhancedCode := TIdSMTPEnhancedCode.Create;
end;

to that:

constructor TIdReplySMTP.Create(ACollection: TCollection);
begin
    inherited Create(ACollection);
    if not assigned (FEnhancedCode) then
      FEnhancedCode := TIdSMTPEnhancedCode.Create;
end;

constructor TIdReplySMTP.Create( ACollection: TCollection;
AReplyTexts: TIdReplies );
begin
    inherited Create(ACollection, AReplyTexts);
    if not assigned (FEnhancedCode) then
      FEnhancedCode := TIdSMTPEnhancedCode.Create;
end;

Source:http://groups.yahoo.com/group/Indy-Dev-Public/message/3252

I'm not sure that it's the best solution, however, it plucked the memory
leak for me, using Indy 10.0.52

HTH,
  Holger

Replies

None

In response to

Memory Leak in TIdSMTP posted by Thomas Zangl on Mon, 20 Dec 2004