Core dump(abort) due to double free at STL string '='operator,with mtmalloc

I have a probrem; my program crashes due to SIGABRT.

My program is multithreaded (about 600 thread total),and uses libmtmalloc for more performance.

By stack trace , when handling of substitution operation ('=' operator) of STL string ,

free() and abort() is called like this:

-- lwp# 235 / thread# 235 --

fe9609d7 _lwp_kill (eb, 6) + 7

fe90cf93 raise(6) + 1f

fe8f0a29 abort(4686b364, 41c05454, fe9e91c0, 20, 4d1e97a8, efe5cfa8) + cd

fed60a99 free(4d1ea1d8) + 193

fe9d5b4a void operator delete(void*) (4d1ea1d8) + 26

feabf612 std::string &std::string::operator=(const std::string &) (4686b364, 41c05454) + 92

081af897 My_Class&My_Class::operator=(const My_Class&) (4686b358, 41c05448) + 3f

I know that , abort() is called when same pointer is freed twice using libmtmalloc.

But i don't know why double-freed when '=' operator of STL string. do you have any idea about it?

This is rarely reproducible, but it does been happened about 2 - 30 days interval.

This double-free is not happend only one specific class , it seems that it is happend at 3 or 4 classes.

Is this libmtmalloc problem or a bug of my program? If it is my bug, any suggetion ?

It seems to be a known bug below ,but this bug is fixed at Sun C++ 5.7.

-> Patch numbers for Sun C++ 5.6: BugIDs: 5041951 sparc: 117549-01 x86:117550-01

5041951 std::string destructor abort on freeing memory in multithreaded environment

Do you have any solution or workaround ?

OS: Solaris10(x86)/Compiler: Sun C++ 5.7

Thanks in advance.

[1650 byte] By [miya38a] at [2007-11-27 11:42:48]
# 1

That particular bug was fixed in C++ 5.6 patch -01, but you also need to get the C++ runtime library patch for your version of Solaris. You can find all patches here:

http://developers.sun.com/sunstudio/downloads/patches/index.jsp

If installing current patches doesn't fix the problem, it could be caused by improper build procedures, or by errors in your code.

clamage45a at 2007-7-29 17:46:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...