Closed GoogleCodeExporter closed 9 years ago
Hmm, this is a tricky one. tcmalloc doesn't recurse, and doesn't provide any
inlineable API in normal usage, so I don't think tcmalloc is contributing to the
stack overflow, if indeed that's what's happening here. However, it's entirely
plausible that tcmalloc would handle stack overflow differently than libc, and
corruptions that are a big problem in one implementation may be a smaller in
another
(and vice versa).
However, it would be strange that a stack overflow would cause a program to
slow down
but not crash, so it may be something else going on entirely.
I think there are tools to help detect stack overflow, some built into gcc (if
you're
using that): -fstack-protector-all, and also a flag that will warn at compile
time if
the stack is too big (I don't know how it handles alloca and equivalent). See,
e.g.,
http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
You may also want to check out mudflap:
http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging
Sounds like a very frustrating problem. :-( Good luck tracking it down!
Original comment by csilv...@gmail.com
on 26 Jun 2009 at 3:25
Hi,
I think I've tracked it down. The problem was in a seemingly completely
unrelated
external dynamically linked library. First of all, I found a case where the heap
corruption was repeatable, I then started taking bits of code out
trial-and-error
style to see what was causing the problem.
It turns out that linking with *name deleted to save embarresment*'s anti-virus
API,
caused heap corruption in such a way that later down the line either glibc's
malloc/free or tcmalloc's crashed a burnt.
There must be something in this libraries init() function causing memory
(probably in
the heap) corruption showhow, as I don't even need to call any of this API's
functions, just link with it at compile time and obviously include function
calls in
the code to make it actually link properly.
Sorry for the red herring, and keep up the good work!
Regards, Dan....
Original comment by donavanb...@gmail.com
on 3 Jul 2009 at 12:33
Great, I'm glad you managed to figure out what's going on!
Original comment by csilv...@gmail.com
on 6 Jul 2009 at 5:30
Original issue reported on code.google.com by
donavanb...@gmail.com
on 26 Jun 2009 at 8:10