开发者

stringstream operator<< crash (malloc_consolidate )

开发者 https://www.devze.com 2023-02-07 00:24 出处:网络
Program terminated with signal 11, Segmentation fault. #00x0000003663c70485 in malloc_consolidate () from /lib64/libc.so.6
Program terminated with signal 11, Segmentation fault.
#0  0x0000003663c70485 in malloc_consolidate () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003663c70485 in malloc_consolidate () from /lib64/libc.so.6
#1  0x0000003663c72a6c in _int_malloc () from /lib64/libc.so.6
#2  0x0000003663c74cde in malloc () from /lib64/libc.so.6
#3  0x0000003d364af4aa in operator new(unsigned long) ()
   **/linux2.6-glibc2.3-x86_64/lib64/libstdc++.so.6
#4  0x0000003d364900ee in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) ()
   from **/linux2.6-glibc2.3-x86_64/lib64/libstdc++.so.6

The code is :

...
       if (logger->isEnabledFor(Level::ALL)) {\
            std::ostringstream oss; \
            oss << message; \
            logger-开发者_StackOverflow中文版>forcedLog(Level::ALL, oss.str(), __FILE__, __LINE__); \
        } \
...

It said that, ostringstream's operator<< isn't a re-enterable function. is that right?

Thanks


This should be because stringstream::operator<< is non-reentrant function.

0

精彩评论

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