-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault occurs with tcmalloc #18
Comments
There isn't really enough information here for me to be able to diagnose what's happening. The code that is responsible for initialising the runtime is allocating memory and this is causing tcmalloc to die. It would help if you could compile a debug build of libobjc2, but it looks from frame 4 as if the allocation size is 24 bytes, which shouldn't be failing. Does tcmalloc rely on global constructors for any of its state? If so, then you may be hitting problems caused by execution order, with the ones in libobjc2 firing first. |
fwiw, I routinely work with a system that uses libobjc2 (master-ish snapshot) in conjunction with tcmalloc from gperftools-2.4, and haven't seen this issue yet. |
Thank you for the help, guys. I did a debug build of libobjc2, and I got a little more data in the stack trace- I've copied it below. I'm going to also try a build without tcmalloc. Stack trace with a debug build of libobjc2:
|
This looks like something has corrupted tcmalloc's internal data structures, or it has not managed to set things up before the constructors run. |
I have a program that I'd like to run under gnustep on an Ubuntu Linux system, linking with libobjc.so.4.6, building with clang/llvm. The program builds without any obvious problems. However, when I try to run it, I get an immediate segmentation fault, even before the start of my main() method. The stack trace, which I've copied below, suggests a problem with startup memory allocation. I'm compiling with tcmalloc-gperftools-r218.
Please let me know if there's anything I might do to debug this, or if it's more likely a bug on my side.
#0 tcmalloc::ThreadCache::Init (this=0x81b098, tid=)
#1 0x0000000000481187 in tcmalloc::ThreadCache::NewHeap (tid=140737353975744) at src/thread_cache.cc:398
#2 0x000000000048100b in tcmalloc::ThreadCache::CreateCacheIfNecessary () at src/thread_cache.cc:375
#3 0x00000000004766ab in GetCache () at ./src/thread_cache.h:423
#4 (anonymous namespace)::do_malloc_no_errno (size=24) at src/tcmalloc.cc:1236
#5 0x00000000004ad1f2 in do_malloc_no_errno_or_cpp_alloc (size=24) at src/tcmalloc.cc:1167
#6 do_calloc (n=, elem_size=) at src/tcmalloc.cc:1253
#7 tc_calloc (n=, elem_size=) at src/tcmalloc.cc:1749
#8 0x00007ffff5e70251 in SparseArrayNewWithDepth () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#9 0x00007ffff5e7035e in SparseArrayNew () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#10 0x00007ffff5e70e3b in init_selector_tables () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#11 0x00007ffff5e6b916 in __objc_exec_class () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#12 0x00007ffff5e7511f in .objc_load_function () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#13 0x00007ffff7dea13a in call_init (l=, argc=argc@entry=3, argv=argv@entry=0x7fffffffe198, env=env@entry=0x7fffffffe1b8) at dl-init.c:78
#14 0x00007ffff7dea223 in call_init (env=, argv=, argc=, l=) at dl-init.c:36
#15 _dl_init (main_map=0x7ffff7ffe1c8, argc=3, argv=0x7fffffffe198, env=0x7fffffffe1b8) at dl-init.c:126
#16 0x00007ffff7ddb30a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
The text was updated successfully, but these errors were encountered: