>Javier wrote in message <6n51ot$s...@forums.borland.com>...
>>Ryan Gallagher escribi en mensaje <6n3v23$r...@forums.borland.com>...
>>[snip]
>>>Here is a test program I wrote to try and solve the problem, I tried
>>>different combinations, but it didn't work......Can someone please help
>me,
>>>if I can't get BSTR's to work, then Our project will require big changes
>:(
>>>The way this program is now there is a HUGE memory leak.
>>>/* TEST PROGRAM */ (Uses a plain form with member variable [ bool
>>> m_bStop ] )
>>>void __fastcall TForm1::Button1Click(TObject *Sender)
>>>{
>>> AnsiString str;
>>> int nCount=0;
>>> m_bStop = false;
>>> while(nCount<100000 && m_bStop ==false)
>>> {
>>> str = "C:\\Test\\Test\\Test\\Test\\Test\\Testing Pass #" +
>>>IntToStr(nCount);
>>> BSTR pbStr = StringToOleStr(str); // If I dont use the
>>>pbStr and just copy str to txText->Text,
>>>// there is no memoryleak
>>> txText->Text = OleStrToString(pbStr);
>>> if(nCount%20 == 0) Application->ProcessMessages();
>>> delete[] pbStr; // This delete doesnt seem to help at
>all...Ive
>>>also tried plain old delete without ([ ]).
>>Maybe I'm a little bit out of my depth... I *must* admit OLE baffles
me....
>>but, from my *very* beginner point of view... you're not creating the BSTR
>>dinamically... so using delete on it won't do a thing :(
>>Also, you're running the loop an enormous number ot f times, so you get a
>>huge number of variables stacking up in memory, although they can't be
>>accessed... I know that, being local to the loop, they should be
>>destroyed... but *maybe* the problem is there...
>>I know that I'll probably be talking nonsense... it's only that seing a
>>"delete" w/o a "new" strikes me as odd :((
>>I only hope I haven't wasted your time :)
>>(PS: I haven't really tried my idea... my BCB just quit on me
>>yestarday -I've just done some big tweaking w/ W95, so I guess I have to
>>reinstall it. )
>>Justo my .002 :)
>>Javier JJ
>>fjpp.s...@softhome.net
>>-------
>>Delete ".spam" from the "from" field to answer
>>-------
>>Borra ".spam" de la direccin para contestar :)