You have to nil the stream object if Assigned(ClientCnx.DocStream) then begin ClientCnx.DocStream.Free; ClientCnx.DocStream:=nil; end;
of just Uses SysUtils; .... if Assigned(ClientCnx.DocStream) then freeandnil(ClientCnx.DocStream) > I tried: > > ClientCnx := TMyHttpConnection(Client); > if Assigned(ClientCnx.DocStream) then > ClientCnx.DocStream.Free; > > and FastMM complains: > > FastMM has detected an attempt to call a virtual method on a freed object. > An access violation will now be raised in order to abort the current > operation. > > ... etc etc > > ----- Original Message ----- > From: "Francois PIETTE" <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Sunday, March 16, 2008 10:18 PM > Subject: Re: [twsocket] httpserver memoryleak > > > >>> Why? do I have to release this stream? >>> >> Of course you have ! >> >> >>> Where is the place to do it? >>> >> When it has been sent and you don't need it anymore. For example from the >> OnRequestDone event handler. >> >> >> -- >> [EMAIL PROTECTED] >> The author of the freeware multi-tier middleware MidWare >> The author of the freeware Internet Component Suite (ICS) >> http://www.overbyte.be >> >> >> ----- Original Message ----- >> From: "George" <[EMAIL PROTECTED]> >> To: "ICS support mailing" <twsocket@elists.org> >> Sent: Sunday, March 16, 2008 6:49 PM >> Subject: [twsocket] httpserver memoryleak >> >> >> >>> Hello, >>> >>> I'm using ICS HttpServer and I have a code: >>> >>> ClientCnx.DocStream := TMemoryStream.Create; >>> ClientCnx.DocStream.Write(Header[1], Length(Header)); >>> ClientCnx.DocStream.CopyFrom(MS2, MS2.Size); >>> MS2.Free; >>> ClientCnx.SendStream; >>> >>> Some times the FastMM memory leak tool reports memory leak >>> in line: >>> >>> ClientCnx.DocStream := TMemoryStream.Create; >>> >>> Why? do I have to release this stream?Where is the place to do it? >>> >>> Thanks >>> >>> -- >>> To unsubscribe or change your settings for TWSocket mailing list >>> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket >>> Visit our website at http://www.overbyte.be >>> >> -- >> To unsubscribe or change your settings for TWSocket mailing list >> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket >> Visit our website at http://www.overbyte.be >> > > -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be