Francois PIETTE wrote: > There is a memory leak in the function "PrepareEmail" in the file > "OverbyteIcsSmtpProt.pas", at line 3376: > > if FMailMessage.GetText^ <> #0 then > > this function allocate some meory which must be freed using > StrDispose. This > is not done in the function.
Correct, GetText is called even twice. So if we do not want to use property TStrings.Text as well as a new String variable, a variable of type PChar is required that can be freed. > It was easy to fix: I replaced the offending line by: > if FMailMessage.Text <> '' then That was my original code, later changed by Francois, probably in order to make it Delphi 1 compatible which doesn't know of TStrings.Text, but why? ICS V6 is for D7 upwards, isn't it? Anyway, since accessing TStrings.Text is slow we could copy the FMailMessage.Text to a new String variable once in TSmtpCli.PrepareEMail and the read from this variable in TSmtpCli.TriggerGetData. An alternate would be to work with a PChar to the message text, but that would require change of some coding functions too currently working with Strings only. What do you think? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > > Now FastMM 4.68 do not report any memory leak. > I see in the source code that the offending line was already replacing > another one. Maybe you have a better solution than mine. > > Contribute to the SSL Effort. Visit > http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > http://www.overbyte.be > > > > ----- Original Message ----- > From: "Francois PIETTE" <[EMAIL PROTECTED]> > To: <twsocket@elists.org> > Sent: Thursday, July 20, 2006 5:59 PM > Subject: [twsocket] Fw: Bug dans OverbyteIcsSmtpProt v6 > > >> >>> Dans la derniere version beta que je viens tout juste de prendre sur >>> votre >>> site, il y a une perde de mémoire dans la fonction "PrepareEmail" du >>> fichier >>> "OverbyteIcsSmtpProt.pas", situé a la ligne 3376: >>> >>> if FMailMessage.GetText^ <> #0 then >>> >>> Cette fonction alloue de la mémoire et celle-ci doit être libérée >>> avec StrDispose(), ce qui n'est pas fait dans la fonction. >>> >>> Facile à corriger, j'ai remplacé la ligne par: >>> >>> if FMailMessage.Text <> '' then >>> >>> et FastMM 4.68 ne rapporte plus aucune perte de mémoire. Je vois >>> dans la source que la ligne fautive en remplace une autre... Peut- >>> être aurez-vous une meilleure solution que la mienne? >>> >>> Merci pour ICS! >> >> -- >> To unsubscribe or change your settings for TWSocket mailing list >> please goto http://www.elists.org/mailman/listinfo/twsocket >> Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be