Markus Humm wrote: > My problem now is that FastMM reports a memory leak when the > application is terminated.
The report attached says that an attempt has been detected to call a virtual method on a freed object. That isn't a memory leak. > The rest of the app. works well enough, I > can connect, send the data etc. disconnect, connect again etc. but > every time I disconnect memory gets lost (some strings and something > unknown, but only a few bytes (always the same amount as it seems)). No idea, however most likely something in your code. > My TCP-server class (TWSocket descendant) holds a reference to the > TWSocket as well which is explicitely set to nil when this socket's > OnSessionClosed is called but directly after it a FreeAndNil(self) is > called. What is "Self"? Why don't you call FreeAndNil(Server.ClientWSocket)? Do you create the client-WSocket with a non-nil owner? How do you free the client-WSocket when the application terminates? May be the next connection is accepted too early? You could post a custom message from OnSessionClosed and free and nil the ClientWSocket from the message handler in order to be sure. > > If I use the full fastMM to trace the memory loss I get something > slightly different or all the same that makes me wonder if my socket > is freed correctly or who tries to call something from it. Using > netstat I can see that the connection properly terminates after some > seconds as expected (I only think it takes a little long to update > the status display but that's a different matter I think and not > avoidable). Even after a socket handle is closed the socket may exist for a while, handled by the OS, nothing one must care about. -- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- 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