THIS WAS A BORLAND COMPILER BUG!!!

IF YOU ARE USING C++ BUILDER READ CAREFULLY:

There is only one operator in C++ that takes three arguments (as you 
probably already know):

condition ? if_true_do_this : if_false_do_this.

The bug occurs in nested cases:

condition1 ? (condition2 ? if2true : if2false) : if1false;

IT LEAKS THE ENTIRE STRING MEMORY!!!! GRRRRR....

Thank you Francois,

SZ

----- Original Message ----- 
From: "Fastream Technologies" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Saturday, March 25, 2006 11:03 AM
Subject: Re: [twsocket] MT HTTP Server ready--IS THIS PASCAL OK?


> Hello,
>
> I am suspcious about:
>
> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> *}
> { Triggered when socket is closed. Need to inform server socket to
> date   }
> { client list and trigger client disconnect
>       }
> procedure TWSocketMTClient.TriggerSessionClosed(ErrCode : Word);
> begin
>    if not FSessionClosedFlag then begin
>        FSessionClosedFlag := TRUE;
>        if Assigned(FServer) then begin
>            try
>                FServer.TriggerClientDisconnect(Self, ErrCode);
>            finally
>                { Calling Destroy will automatically remove client from 
> list
> because }
>                { we installed a notification
>         }
>                Release;
>            end;
>        end;
>        inherited TriggerSessionClosed(ErrCode);
>    end;
> end;
>
> This is called in the worker thread context and I removed the postmessage
> for speed. But I am not sure of Release()--is it ok to be called before
> inherited TriggerSessionClosed()?
>
> Left problems:
> - lock up
> - memory leak
>
> bad enough? ;((
>
> SZ
>
> ----- Original Message ----- 
> From: "Fastream Technologies" <[EMAIL PROTECTED]>
> To: "ICS support mailing" <twsocket@elists.org>
> Sent: Friday, March 24, 2006 7:49 PM
> Subject: Re: [twsocket] MT HTTP Server ready with a single -minor- problem
>
>
>> Hello,
>>
>> There has to be a timing problem in the below code that causes an AV and
>> that should be the source of the server stopping problem. Does anyone see
>> it?
>>
>> It's been 9 hours today and that's enough for today for me with this... 
>> ;(
>>
>> Regards,
>>
>> SZ
>>
>> ----- Original Message ----- 
>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" <twsocket@elists.org>
>> Sent: Friday, March 24, 2006 12:07 PM
>> Subject: [twsocket] MT HTTP Server ready with a single -minor- problem
>>
>>
>>> Hello Francois,
>>>
>>> The system compiles and runs now. It gives 790 requests/sec on my XP 
>>> Home
>>> :)
>>> until time_wait sockets reach a certain level where it starts to drop
>>> connections!! (httpServerThread is the listener thread. Inside it there
>>> is
>>> a
>>> THTTPServer which is a descendent of THttpMTServer of Pascal.)
>>>
>>> Example C++ Usage of the attached code:
>>> Now TriggerClientConnect and disconnect are called from worker thread
>>> context.
>>>
>>> void __fastcall THTTPThread::processServerThreadMessage(const MSG &msg)
>>> {
>>> if(msg.message == WM_HTTP_CLIENT_THREAD_ATTACH) // detachment is done in
>>> serverThread
>>>        {
>>>                TWSocketMTServer *socketServer =
>>> (TWSocketMTServer*)(void*)msg.wParam;
>>>                httpServerClientClass *httpClient = new
>>> httpServerClientClass(socketServer);
>>>                httpClient->affinityThread = this;
>>>                socketServer->AfterClientCreated(httpClient, 0,
>>> msg.lParam);
>>> }
>>> else
>>>    DispatchMessage(msg);
>>>
>>> // this is the worker thread message pump
>>>
>>> void __fastcall httpServerThread::HTTPServerCreateClient(int NewHSocket)
>>> {
>>>        THTTPThread *affinityThread =
>>> httpServerClientThreadManager->getHTTPThread();
>>>
>>>        if(affinityThread)
>>>                while(!PostThreadMessage(affinityThread->ThreadID,
>>> WM_HTTP_CLIENT_THREAD_ATTACH, (WPARAM)HTTPServer->WSocketServer,
>>> (LPARAM)NewHSocket))
>>>                        ::Sleep(1);
>>> }
>>> //---------------------------------------------------------------------------
>>>
>>> Now the slight problem: when I run in debug mode in Memproof, I get 11MB
>>> used report but task manager reports 45MB after a 5min test! This is a
>>> big
>>> problem for end user tests!!!
>>>
>>> Best Regards,
>>>
>>> SZ
>>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>>
>>> -- 
>>> 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
>
> -- 
> 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

Reply via email to