mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

mi_heap_try_new: throw and SIGABORT(6)

Open Lee-HyeongSeok opened this issue 10 months ago • 6 comments

OS : CentOS 7 mimalloc version : v2.1.2 Ram : 128G Process Virtual memory at the time of occurrence : 80G Process physical memory at the time of occurrence : 22G Problems :

  1. When physical memory is using about 50% of virtual memory, virtual memory is continuously increased.
  2. When virtual memory increased to about 80G, physical memory tended to stabilize. ex) VmSize 51357 mb VmRSS 17572 mb VmSize 51357 mb VmRSS 17605 mb VmSize 51357 mb VmRSS 17667 mb VmSize 51357 mb VmRSS 17703 mb VmSize 51357 mb VmRSS 17689 mb VmSize 51357 mb VmRSS 17707 mb VmSize 51357 mb VmRSS 17744 mb VmSize 51357 mb VmRSS 17778 mb VmSize 51357 mb VmRSS 17826 mb VmSize 51357 mb VmRSS 17846 mb VmSize 51357 mb VmRSS 17858 mb ... VmSize 51357 mb VmRSS 28963 mb VmSize 51357 mb VmRSS 28950 mb VmSize 51357 mb VmRSS 28916 mb VmSize 59549 mb VmRSS 49660 mb VmSize 80029 mb VmRSS 69506 mb VmSize 80029 mb VmRSS 57715 mb VmSize 80029 mb VmRSS 39002 mb VmSize 80029 mb VmRSS 37487 mb VmSize 80029 mb VmRSS 36094 mb VmSize 80029 mb VmRSS 34949 mb VmSize 80029 mb VmRSS 33972 mb
  3. As shown above, when the virtual memory is sufficiently increased, SIGABORT occurs due to the following call stack.

case 1. Occurs when constructing a std::string using boost::str and boost::format. #0 0x00007f7183b96ba5: __nanosleep [libc-2.29.so] #1 0x00007f7183b96aaa: sleep [libc-2.29.so] #2 0x000000000043d043: crash_handler(int, siginfo_t*, void*) [myProcess] #3 0x00007f7184746190: __restore_rt [libpthread.so.0] #4 0x00007f7183b09531: raise [libc-2.29.so] #5 0x00007f7183af4975: abort [libc-2.29.so] #6 0x00007f7184274647: __gnu_cxx::__verbose_terminate_handler() [clone .cold] [libstdc++.so.6] #7 0x00007f718427fe86: __cxxabiv1::__terminate(void ()()) [libstdc++.so.6] #8 0x00007f718427fed1: std::terminate() [libstdc++.so.6] #9 0x00007f7184280104: __cxa_throw [libstdc++.so.6] #10 0x00007f7184f288ab: mi_heap_try_new(mi_heap_s, unsigned long, bool) [libmimalloc.so.2] #11 0x000000000044e9ed: boost::basic_format<char, std::char_traits, std::allocator >::basic_format(char const*) [myProcess]

case 2. Occurs in the process of passing the begin and end of std::string to the std::ostream buffer. #0 0x00007faa1ebb6ba5: __nanosleep [libc-2.29.so] #1 0x00007faa1ebb6aaa: sleep [libc-2.29.so] #2 0x000000000043d043: crash_handler(int, siginfo_t*, void*) [myProcess] #3 0x00007faa1f766190: __restore_rt [libpthread.so.0] #4 0x00007faa1eb29531: raise [libc-2.29.so] #5 0x00007faa1eb14975: abort [libc-2.29.so] #6 0x00007faa1f294647: __gnu_cxx::__verbose_terminate_handler() [clone .cold] [libstdc++.so.6] #7 0x00007faa1f29fe86: __cxxabiv1::__terminate(void ()()) [libstdc++.so.6] #8 0x00007faa1f29fed1: std::terminate() [libstdc++.so.6] #9 0x00007faa1f2a0104: __cxa_throw [libstdc++.so.6] #10 0x00007faa1ff488ab: mi_heap_try_new(mi_heap_s, unsigned long, bool) [libmimalloc.so.2] #11 0x00007faa1f332ddc: std::__cxx11::basic_string<char, std::char_traits, std::allocator >::reserve(unsigned long) [libstdc++.so.6]

==> What they have in common is that an exception occurred in the process of allocating heap memory space through mimalloc.

Do you know the cause and solution?

Lee-HyeongSeok avatar Feb 04 '25 02:02 Lee-HyeongSeok