开发者

How do you find out who created a private heap?

开发者 https://www.devze.com 2023-01-14 03:29 出处:网络
I have an Windows C++ application which has a memory leak.I am pretty sure the leak is in one of our (many) linked libraries.I have instrumented the global new and delete function in our app and the a

I have an Windows C++ application which has a memory leak. I am pretty sure the leak is in one of our (many) linked libraries. I have instrumented the global new and delete function in our app and the app calls to allocate memory seem fine. They account for about 10% of the process working set though. When I walk the heaps // http://msdn.microsoft.com/en-us/library/ee175819%28v=VS.85%29.aspx returned by GetProcessHeaps() http://msdn.microsoft.com/en-us/library/aa366571%28v=VS.85%29.aspx

I can see about a dozen heaps, one of which has about a half gigabyte of allocation开发者_StackOverflow中文版s in it. Opps!

Ok so HOW can I find out which of the libs are doing it? Is there anyway to figure out who is allocating the heaps? I have the handle of each heap.


The straightforward method would be to hook the HeapCreate() function. An example of doing that is here.

0

精彩评论

暂无评论...
验证码 换一张
取 消