cuitao2046 / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

missing HeapReAlloc on windows will cause ATL/MFC App crash ? #298

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Because ATL has it's own memory management component using HeapAlloc / 
HeapReAlloc and HeapFree APIs.

So I'm wonder if only hook HeapAlloc / HeapFree but not HeapReAlloc would crash 
application using all that three APIs?

Original issue reported on code.google.com by baiyang@gmail.com on 27 Dec 2010 at 9:35

GoogleCodeExporter commented 9 years ago
As I understand it, HeapRealloc just calls HeapAlloc, internally, so everything 
should work ok.  If you can come up with a minimal example that causes a crash, 
I'm happy to take a look, but I don't think use of HeapRealloc is the problem.

Original comment by csilv...@gmail.com on 27 Dec 2010 at 9:38

GoogleCodeExporter commented 9 years ago
Ok, the whole story is: we have a app using MFC. It is working fine with a long 
time. But when we replace the memory management component to tcmalloc 1.5 in 
several months ago, It become crashed randomly with memory access violations 
(with the DEP is on).

We finally give up to using tcmalloc on this app. But I'm often thinking about 
this issue. And I just want to sure if it has been fixed on the new 1.6 version.

Original comment by baiyang@gmail.com on 5 Jan 2011 at 7:23

GoogleCodeExporter commented 9 years ago
It's possible the error is in your program: it's possible for a program with 
undefined behavior to run properly with one memory allocator, and crash with 
another.  Of course, it's also very possible the problem is with tcmalloc 
somewhere.  The only way to tell, unfortunately, is for you to debug the issue 
a bit on your end to see where, if not why, it's crashing.

Original comment by csilv...@gmail.com on 5 Jan 2011 at 8:35

GoogleCodeExporter commented 9 years ago
I have tried the newest version 1.7 on our app. And everything is ok now. :-)

Original comment by baiyang@gmail.com on 1 Apr 2011 at 4:31

GoogleCodeExporter commented 9 years ago
BTW: The buggy version which crashed our app is 1.5

Original comment by baiyang@gmail.com on 1 Apr 2011 at 4:40

GoogleCodeExporter commented 9 years ago
Wonderful news!  We did change some code in a recent release involving some 
windows patches we were doing wrong, so perhaps that fixed things.  In any 
case, I'll mark this as fixed now.

Original comment by csilv...@gmail.com on 5 Apr 2011 at 5:07