jemalloc on Solaris (Joyent SmartOS)

Paul Smith paul at mad-scientist.net
Thu Sep 5 06:25:53 PDT 2013


Hi all.

I have some software using jemalloc (in a large, heavily multi-threaded
C++ program) currently running on Linux, MacOSX, and Windows, and we are
porting it to Joyent's cloud-based SmartOS offering, which is Solaris
underneath.  This is compiled using GCC 4.7.0 (that's the version
packaged with this OS).

I'm using jemalloc 3.1.0-0-g3b1f3aca54fede23299cde9034f7b909c3d290d7
currently; I'm not adverse to upgrading if that's warranted.

When I start my program it dumps core.  Examining the core dump the
problem is obvious: my program is going into an infinite recursion
trying to allocate memory.

Based on the stacktrace I rebuilt jemalloc without TLS support
(--disable-tls), then I don't get this failure but I've not tested far
enough to know if there might be other issues.

My main question is, I've noted that http://www.canonware.com/jemalloc/
doesn't list Solaris as supported by the stand-alone jemalloc
implementation, which is what I'm using.  A subsequent bullet item lists
Solaris as being supported by the version of jemalloc that's included in
Mozilla's FireFox allocator.

Is that still the situation today?  I'd really prefer to not try to use
two different versions of jemalloc on my different platforms.  Is anyone
familiar with the differences, and can they advise me on my best bet
going forward?  Should I continue on working with stand-alone jemalloc
on Solaris, or should I investigate using the version in FireFox?


FYI, the recursion looks like this:

Program terminated with signal 11, Segmentation fault.
#0  0x0000000001c7c4e7 in icalloc ()
#0  0x0000000001c7c4e7 in icalloc ()
#1  0x0000000001c8095e in calloc ()
#2  0x0000000001d099b1 in __emutls_get_address (obj=0x1ff3f40) at ../../../gcc-4.7.0/libgcc/emutls.c:159
#3  0x0000000001c7a738 in tcache_tsd_get ()
#4  0x0000000001c7aa4e in tcache_get ()
#5  0x0000000001c7bbde in arena_malloc ()
#6  0x0000000001c7c4b5 in icallocx ()
#7  0x0000000001c7c4ec in icalloc ()
#8  0x0000000001c8095e in calloc ()
#9  0x0000000001d099b1 in __emutls_get_address (obj=0x1ff3f40) at ../../../gcc-4.7.0/libgcc/emutls.c:159
#10 0x0000000001c7a738 in tcache_tsd_get ()
#11 0x0000000001c7aa4e in tcache_get ()
#12 0x0000000001c7bbde in arena_malloc ()
#13 0x0000000001c7c4b5 in icallocx ()
#14 0x0000000001c7c4ec in icalloc ()
#15 0x0000000001c8095e in calloc ()
#16 0x0000000001d099b1 in __emutls_get_address (obj=0x1ff3f40) at ../../../gcc-4.7.0/libgcc/emutls.c:159
    ....
#191103 0x0000000001c7a738 in tcache_tsd_get ()
#191104 0x0000000001c7aa4e in tcache_get ()
#191105 0x0000000001c7bbde in arena_malloc ()
#191106 0x0000000001c7c4b5 in icallocx ()
#191107 0x0000000001c7c4ec in icalloc ()
#191108 0x0000000001c8095e in calloc ()
#191109 0x0000000001d099b1 in __emutls_get_address (obj=0x1ff3f40) at ../../../gcc-4.7.0/libgcc/emutls.c:159
#191110 0x0000000001c7a738 in tcache_tsd_get ()
#191111 0x0000000001c7aa4e in tcache_get ()
#191112 0x0000000001c7bbde in arena_malloc ()
#191113 0x0000000001c7c43c in imallocx ()
#191114 0x0000000001c7c473 in imalloc ()
#191115 0x0000000001c80021 in malloc ()
#191116 0x0000000000934fb2 in Init() ()
#191117 0x00000000009353f0 in __static_initialization_and_destruction_0 ()
#191118 0x000000000093540c in _GLOBAL__sub_I_JEMemory.cpp ()
#191119 0x0000000001d09b66 in __do_global_ctors_aux ()
#191120 0x0000000001d09b8e in _init ()
#191121 0x0000000000759103 in _start ()





More information about the jemalloc-discuss mailing list