I get the impression that the allocator I get from libc if I do
nothing special is not thread safe. It crashes with double-free when I
try to use C++ functions (via a C interface) which are otherwise
thread-safe (but try to allocate/free).
What is the easiest way to achieve this?
Here is what I have so far, but I'm happy to discard it all if there
is a better way.
https://gist.github.com/pwaller/b805ddc57de281bc1659
(In summary, a Dockerfile which builds a binary with `-tags netgo` and
`-ldflags '-linkmode external -extldflags "-static -Wl,-v
-Wl,--eh-frame-hdr"'`, a main.go which uses cgo to try and do an alloc
and free)
I'm trying to use jemalloc (I picked an allocator at random which
looked easy to build). It crashes on program start with a stack trace
I cannot decipher, reproduced below.
Any advice?
Thanks,
- Peter
Program received signal SIGSEGV, Segmentation fault.
0x000000000051065c in get_nprocs ()
(gdb) bt
#0 0x000000000051065c in get_nprocs ()
#1 0x000000000050d7b5 in sysconf ()
#2 0x000000000049d9b6 in malloc_ncpus () at ../src/jemalloc.c:256
#3 malloc_init_hard () at ../src/jemalloc.c:776
#4 0x000000000049e32d in malloc_init () at ../src/jemalloc.c:292
#5 je_malloc (size=<optimised out>) at ../src/jemalloc.c:929
#6 0x0000000000541753 in _dl_get_origin ()
#7 0x0000000000511f0f in _dl_non_dynamic_init ()
#8 0x0000000000512e08 in __libc_init_first ()
#9 0x00000000004d5d82 in __libc_start_main ()
#10 0x00000000004019a7 in _start ()
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.