|
|
|
|
"Jeff Partch [MVP]" wrote:
> "aotin" <aotin@discussions.microsoft.com> wrote in message
> news:3855E3CA-B224-48EB-8419-8584DA6165E9@microsoft.com...
>
> Yes.
> --
> Jeff Partch [VC++ MVP]
>
>
>
but why?
even i don't do that, there is no memory leak be detected?
can you show me more details about that.
thanks.
| |
| Jochen Kalmbach [MVP] 2005-06-02, 4:02 am |
| Hi aotin!
[color=darkred]
>
> but why?
> even i don't do that, there is no memory leak be detected?
> can you show me more details about that.
Who should detect the leak?
This is not an CRT-Allocation, so CRT does not detect it...
And the allocation occurs inside the COM-Stub, so I do not know if tools
like Purify or other will detect the allocation...
--
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/
| |
|
| >
> Who should detect the leak?
> This is not an CRT-Allocation, so CRT does not detect it...
> And the allocation occurs inside the COM-Stub, so I do not know if tools
> like Purify or other will detect the allocation...
>
> --
> Greetings
> Jochen
>
Oh. i see.
_CrtDumpMemoryLeaks() cannot detect the memory leak in com object.
i have tried another case:
//---------------------------------------
_CrtDumpMemoryLeaks();
{
BSTR bstrTMP = SysAllocString(L"ABCDEFG");
//...
//without: SysFreeString(bstrTMP);
}
_CrtDumpMemoryLeaks();
//---------------------------------------
_CrtDumpMemoryLeaks() also cannot detect the memory leak here.
so, in my first Q, the answer is:
The SysFreeString(bstrXML) is necessary to call by user to free the buffer.
thanks all of you guys.
| |
|
|
| Simon Watson 2005-06-02, 9:06 am |
| One method for checking for COM memory leaks (including BSTRs) is the
IMallocSpy method. Have a look at
http://msdn.microsoft.com/library/d...fimallocspy.asp
and
http://www.microsoft.com/msj/0699/v...alprog0699.aspx
cheers
Simon
"aotin" <aotin@discussions.microsoft.com> wrote in message
news:F6B2A02A-FCF5-4632-97C6-0BF007C4B4E9@microsoft.com...
>
>
> Oh. i see.
>
> _CrtDumpMemoryLeaks() cannot detect the memory leak in com object.
>
> i have tried another case:
>
> //---------------------------------------
> _CrtDumpMemoryLeaks();
> {
> BSTR bstrTMP = SysAllocString(L"ABCDEFG");
> //...
> //without: SysFreeString(bstrTMP);
> }
> _CrtDumpMemoryLeaks();
> //---------------------------------------
>
> _CrtDumpMemoryLeaks() also cannot detect the memory leak here.
>
> so, in my first Q, the answer is:
>
> The SysFreeString(bstrXML) is necessary to call by user to free the
buffer.
>
> thanks all of you guys.
>
| |
|
|
|
|
|
|
|
|