Login  
Search All Forums
Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web Enterprise for ActiveX
Topic: How to resolve memory leakage in BCB 4 & PowerTCP
Rio

From: Moscow, Russia
Posts: 22
Member Since: 11/12/01
posted August 27, 2002 7:39 AM

YOUR PostDemo DEMO-APPLICATION: :

txtResults->Text = WebASP1->Response->Body->ReadString(0);

*** MY MODIFICATION:

 BSTR data = WebASP1->Response->Body->ReadString(0);
 txtResults->Text = data;
 SysFreeString(data);

** OR

AnsiString DartsBstr2AnsiString(BSTR bstr)
{
 AnsiString result = bstr;
 SysFreeString(bstr);
 return result;
}
.......aAnswer->Body = DartsBstr2AnsiString(WebASP->Response->Body->ReadString(0));
Rio

From: Moscow, Russia
Posts: 22
Member Since: 11/12/01
posted August 27, 2002 8:00 AM

Please explain me, if i use PowerTCP
methods&propeties which return BSTR,
in what case i must use SysFreeString(...)???
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted August 27, 2002 9:15 AM

You would have to do that anywhere that you got a BSTR that you did not allocate. In the case above 'data' is allocated by us inside the ReadString method, so you have to free it later.
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX