Re: [twsocket] TiggerSessionClosed...
> I try to avoid calling the message pump Ditto. > DisconnectAll That worked. So, now I close the server, call DisconnectAll and no memory leak. 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
Re: [twsocket] TiggerSessionClosed...
zayin wrote: >> ..happens, for instance, _if the destination Window has been >> destroyed after the call to PostMessage > > Because the program is ending when the leak occurs that is exactly > what I think is occurring. > > So, after I close all the clients, I call now server.ProcessMessages > and that seems to handle the leak. > > Do you see any problem with that solution? Don't know, generaly I try to avoid calling the message pump, in case of destroying the TWSocketServer object it's better to "abort" all clients, have you tried method DisconnectAll already? -- Arno -- 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
Re: [twsocket] TiggerSessionClosed...
> ..happens, for instance, _if the destination Window has been destroyed after the call to PostMessage Because the program is ending when the leak occurs that is exactly what I think is occurring. So, after I close all the clients, I call now server.ProcessMessages and that seems to handle the leak. Do you see any problem with that solution? Thanks for your help and time Arno. -- 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
Re: [twsocket] TiggerSessionClosed...
zayin wrote: >> but unless is cumulative it really does not matter. > > I concur. It is just a pain. > > IMHO, there should be some step(s) to close the clients and close the > server and not have a memory leak. I've never seen that leak, anyway Close server's listening socket in order to disable new connections before destroying/closing all connected clients and freeing the TWSocketServer object. As I wrote before the allocated memory is either freed when the message is handled (the default) or when the call to PostMessage() failed, so the only case where a leak may happen is when PostMessage() succeeded however that message is never handled (happens, for instance, _if the destination Window has been destroyed after the call to PostMessage). -- Arno -- 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
Re: [twsocket] TiggerSessionClosed...
> but unless is cumulative it really does not matter. I concur. It is just a pain. IMHO, there should be some step(s) to close the clients and close the server and not have a memory leak. -- 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
Re: [twsocket] TiggerSessionClosed...
> > It is probably a false report... > MadExcept also reports it as a memory leak. So after say 10,000 connections, how much extra memory is your application using than when it started? The VCL often leaks small amounts of memory, but unless is cumulative it really does not matter. Use something like: var ProcMem: TProcessMemoryCounters; begin GetProcessMemoryInfo (GetCurrentProcess, @ProcMem, SizeOf(ProcMem)) ; with ProcMem do begin AddLogLine ('Program Memory Usage: Working Set ' + IntToKbyte (WorkingSetSize) + ', Paged Pool ' + IntToKbyte (QuotaPagedPoolUsage) + ', Non Paged Pool ' + IntToKbyte (QuotaNonPagedPoolUsage)) ; end ; end; You can also log program handle usage and global memory and handle usage to find serious problems. Angus -- 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
Re: [twsocket] TiggerSessionClosed...
> It is probably a false report... MadExcept also reports it as a memory leak. -- 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
Re: [twsocket] TiggerSessionClosed...
> It is on shutdown so I am not worried. The issue is FastMM reports > the leak each time I quit and that is a pain. It is probably a false report. I use the ICS web server which uses SocketServer, and there are no memory leaks after over 100,000 connections. Angus -- 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
Re: [twsocket] TiggerSessionClosed...
Thanks for the reply Arno. >Otherwise make sure you close all clients before destroying the server component. I made sure that happens before posting the message and the clients are freed before the server. It is on shutdown so I am not worried. The issue is FastMM reports the leak each time I quit and that is a pain. Any idea how I can handle? Some call to the server before freeing it to handle all the messages. Or ??? -- 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
Re: [twsocket] TiggerSessionClosed...
zayin wrote: > Hello, > > I have upgraded from D2007 to XE and I am now using version 7.04 of > ICS. > > When I close the socket I am getting a memory leak at line 686 in > TWSocketClient. TiggerSessionClosed. > > the line is New(PIdRec); > > I do see that if the PostMessage call fails, PIdRec is released on > line 696. > > If the PostMessage succeeds, PIdRec is not released. > > I have no idea why the PostMessage would fail. If it failed there won't be a leak, the allocated memory will be freed when that message is handled. The "leak" happens when the call to PostMessage() succeeds however the TWSocketServer component will be destroyed before that message has been processed. If that happens on application exit nothing to worry about. Otherwise make sure you close all clients before destroying the server component. -- Arno -- 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
[twsocket] TiggerSessionClosed...
Hello, I have upgraded from D2007 to XE and I am now using version 7.04 of ICS. When I close the socket I am getting a memory leak at line 686 in TWSocketClient. TiggerSessionClosed. the line is New(PIdRec); I do see that if the PostMessage call fails, PIdRec is released on line 696. If the PostMessage succeeds, PIdRec is not released. I have no idea why the PostMessage would fail. Am I wrong in thinking PIdRec should be released regardless of PostMessage success/fail? Ideas? Thanks, Mark -- 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