For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > why?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author why?
aotin

2005-06-02, 4:02 am



"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/
aotin

2005-06-02, 9:06 am

>
> 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.

Rodrigo Corral [MVP]

2005-06-02, 9:06 am

This document could be interesting for you

http://www.winwonk.com/writing/commemory/


--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org


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.
>



Jochen Kalmbach [MVP]

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


You can also use my leak-finder:

http://blog.kalmbachnet.de/?postid=13


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
aotin

2005-06-03, 3:59 am

"Rodrigo Corral [MVP]" wrote:

> This document could be interesting for you
>
> http://www.winwonk.com/writing/commemory/
>
>
> --
> Un saludo
> Rodrigo Corral González [MVP]
>
> FAQ de microsoft.public.es.vc++
> http://rcorral.mvps.org
>
>



it is a good article!

thanks a lot!!!
aotin

2005-06-03, 3:59 am

"Jochen Kalmbach [MVP]" wrote:

>
> You can also use my leak-finder:
>
> http://blog.kalmbachnet.de/?postid=13
>
>
> --
> Greetings
> Jochen
>
> My blog about Win32 and .NET
> http://blog.kalmbachnet.de/
>


all of you are great. thanks a lot!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com