Re: HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- From: "Arkady Frenkel" <arkadyf@xxxxxxxxxxxxxxxx>
- Date: Wed, 24 Aug 2005 10:01:30 +0200
Eugene!
Just demystifying CSocket attach :) member : it create socket and window
for notifications and put both ( window and socket ) handles in it's
internal map
Arkady
"Eugene Gershnik" <gershnik@xxxxxxxxxxx> wrote in message
news:exYM6REqFHA.2628@xxxxxxxxxxxxxxxxxxxxxxx
> Roger Garrett wrote:
>
>> pSocket->Detach();
>
> This most likely detaches a C++ CSocket object from OS SOCKET. (I don't
> know what exactly CSocket does but this is the usual MFC naming
> convention)
>
>> pSocket->Close();
>
> This is probably no-op as there is no SOCKET to close in CSocket anymore
>
>> delete pSocket;
>
> And this destroys C++ object while the OS SOCKETS continues to live ;-)
>
> If I am right it gives another reason why MFC's use of double-state
> anti-pattern is a huge mistake.
>
> --
> Eugene
> http://www.gershnik.com
>
>
>
>> }
>>
>> That is, it merely allocates a CSocket and then deletes it.
>> Wnen I go through this loop I can watch the memory usage go up and up.
>> Clearly, the delete of the CSocket is not entirely deleting
>> everything.
>>
>> SAME PROBLEM WITH CAsyncSocket
>>
>> I also tried the very same kind of thing with CAsyncSocket and I get
>> the very same symptoms, of memory constantly increasing for the app.
>>
>> Is there a solution to the problem of not fully deleting CSockets or
>> CAsyncSockets?
>>
>> I really need some help on this.
>
>
.
- Follow-Ups:
- Re: HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- From: Roger Garrett
- Re: HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- References:
- HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- From: Roger Garrett
- Re: HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- From: Eugene Gershnik
- HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- Prev by Date: Re: Mailslots: Difference between NT4 and Windows 2000/XP
- Next by Date: Re: how can i get the right dhcp state of the network adapter in winme
- Previous by thread: Re: HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- Next by thread: Re: HELP!! CSocket and CAsyncSocket Consumes Memory Uncontrollably
- Index(es):
Relevant Pages
|