FW: malloc(): error: malloc recursive

Ady_Li at trendmicro.com.cn Ady_Li at trendmicro.com.cn
Mon May 16 23:54:09 PDT 2005



hi all,
> when i wrote a multi-pthread program in fbsd,=0D
> at the first few second, it would core out with "malloc(): error:  malloc=
 recursive" or=0D
> "free(): error:  malloc recursive", there are more similar question in=
 the maillist,=0D
> but i still do not know how to solved it=2E
>=0D
> CC_FLAGS=3D -g -O  -fPIC #-DTHREAD -DDEBUG
> LPTHREAD=3D-lpthread -D_THREAD_SAFE -D_REENTRANT
> VCC_FLAGS=3D -g -O  -fPIC -DFBSD -DFBSD2 -DFBSD3 -DFBSD4 -DIMPORT_VSAPI=
 $(LPTHREAD) #-DTHREAD -DDEBUG
> LD=3Dg++
> LD_FLAGS=3D -g -O  -fPIC -shared  #-DTHREAD -DDEB
kernel: FreeBSD ady_li_fbsd=2Eclient=2Ecn=2Etrendnet=2Eorg 5=2E3-RELEASE=
 FreeBSD 5=2E3-RELEASE #0: Fri Nov  5 04:19:18 UTC 2004     root at harlow=
=2Ecse=2Ebuffalo=2Eedu:/usr/obj/usr/src/sys/GENERIC  i386


$ gdb dispatcher dispatcher=2Ecore
GNU gdb 6=2E1=2E1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc=2E
GDB is free software, covered by the GNU General Public License, and you=
 are
welcome to change it and/or distribute copies of it under certain=
 conditions=2E
Type "show copying" to see the conditions=2E
There is absolutely no warranty for GDB=2E  Type "show warranty" for=
 details=2E
This GDB was configured as "i386-marcel-freebsd"=2E=2E=2E
Core was generated by `dispatcher'=2E
Program terminated with signal 6, Aborted=2E
Reading symbols from /usr/lib/libstdc++=2Eso=2E4=2E=2E=2Edone=2E
Loaded symbols for /usr/lib/libstdc++=2Eso=2E4
Reading symbols from /lib/libm=2Eso=2E3=2E=2E=2Edone=2E
Loaded symbols for /lib/libm=2Eso=2E3
Reading symbols from /lib/libc=2Eso=2E5=2E=2E=2Edone=2E
Loaded symbols for /lib/libc=2Eso=2E5
Reading symbols from /home/ady/SinaScanner2=
=2E0/SinaScannerService/mailscanner/product/1=2E0=2E0000/dispatcher=2Eso=2E=
=2E=2Edone=2E
Loaded symbols for /home/ady/SinaScanner2=
=2E0/SinaScannerService/mailscanner/product/1=2E0=2E0000/dispatcher=2Eso
Reading symbols from /usr/lib/libpthread=2Eso=2E1=2E=2E=2Edone=2E
Loaded symbols for /usr/lib/libpthread=2Eso=2E1
Reading symbols from /libexec/ld-elf=2Eso=2E1=2E=2E=2Edone=2E
Loaded symbols for /libexec/ld-elf=2Eso=2E1
#0  0x281b11d7 in kill () from /lib/libc=2Eso=2E5
(gdb) where
#0  0x281b11d7 in kill () from /lib/libc=2Eso=2E5
#1  0x281a627e in raise () from /lib/libc=2Eso=2E5
#2  0x28218627 in abort () from /lib/libc=2Eso=2E5
#3  0x28116a1d in __gnu_cxx::__verbose_terminate_handler () from=
 /usr/lib/libstdc++=2Eso=2E4
#4  0x2811b16e in __cxxabiv1::__terminate () from /usr/lib/libstdc++=2Eso=
=2E4
#5  0x2811b1a4 in std::terminate () from /usr/lib/libstdc++=2Eso=2E4
#6  0x2811b0f9 in __cxa_throw () from /usr/lib/libstdc++=2Eso=2E4
#7  0x2811e0f2 in operator new () from /usr/lib/libstdc++=2Eso=2E4
#8  0x280c3aef in __gnu_cxx::new_allocator<char>::allocate () from=
 /usr/lib/libstdc++=2Eso=2E4
#9  0x280d7a56 in std::string::_Rep::_S_create () from /usr/lib/libstdc++=
=2Eso=2E4
#10 0x280d82ab in std::string::_S_construct<char const*> () from=
 /usr/lib/libstdc++=2Eso=2E4
#11 0x280d5094 in std::basic_string<char, std::char_traits<char>,=
 std::allocator<char> >::basic_string ()
   from /usr/lib/libstdc++=2Eso=2E4
#12 0x28251c83 in CBasePolicies::SetPolicy (this=3D0xbf8f6ed4, pstrName=
=3D0xbf8f6624 "FILE",=0D
    pstrValue=3D0xbf8f6214=
 "/home/ady/SinaScannerService/mailscanner/dispatcher")
    at /home/ady/SinaScanner2=
=2E0/SinaScannerService/src/dispatcher/baseclass=2Ecpp:26
#13 0x282513b6 in CMsgWrapper::UnEncapsulate (this=3D0x28270b8c,=0D
    pstrMsg=3D0x806d01c "REQUEST/2=
=2E0\r\nTASK:Single\r\nFILE:/home/ady/SinaScannerService/mailscanner/dispat=
cher\r\nACTN:ScanOnly\r\nREQUEST/2=
=2E0\r\nTASK:Single\r\nFILE:/home/ady/SinaScannerService/mailscanner/dispat=
cher\r\nACTN:ScanOnly\r\n\r\n", nMsgSize=3D200, nMsgOffset=3D at 0xbf8f6aac,=
 objPolicies=3D at 0xbf8f6ed4)
    at /home/ady/SinaScanner2=
=2E0/SinaScannerService/src/dispatcher/msgwrapper=2Ecpp:292
#14 0x28259407 in RecvRequest (p=3D0x0)
    at /home/ady/SinaScanner2=
=2E0/SinaScannerService/src/dispatcher/dispatcher=2Ec:1427
#15 0x2828539f in pthread_mutexattr_init () from /usr/lib/libpthread=2Eso=
=2E1
#16 0x00000000 in ?? ()
(gdb)=0D

> Best Regards,
> Ady Li
> [TEL](86)25-84510988-656
> =0D
>=0D

TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential=
 and may be subject to copyright or other intellectual property protection=
=2E If you are not the intended recipient, you are not authorized to use or=
 disclose this information, and we request that you notify us by reply mail=
 or telephone and delete the original message from your mail system=2E


More information about the freebsd-threads mailing list