Greetings, and thanks so much! Extremely helpful. I'm amazed you ever got past this.
gcl_init_alloc has to finish without calling malloc. macosx sscanf called via get_gc_environ does. Just comment out the call to get_gc_environ in update_real_maxpage and please let me know if this goes away. Ideally you could run under gdb, breaking at gcl_init_alloc and alloc.c:malloc, (gdb) r ./ <foo, and (gdb) fin when the former is reached. Make sure it finishes without calling malloc again. Take care, "Kirill A. Korinsky" <[email protected]> writes: > I really doubt that it makes something useful. > > I've attached to process by debug and it says: > > (lldb) bt > ^C* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS > (code=1, address=0x0) > * frame #0: 0x0000000000000000 > frame #1: 0x00007ff803977ff1 libsystem_c.dylib`__smakebuf + 384 > frame #2: 0x00007ff803985b52 libsystem_c.dylib`__swsetup + 148 > frame #3: 0x00007ff803963b92 libsystem_c.dylib`__v2printf + 86 > frame #4: 0x00007ff803975912 libsystem_c.dylib`vfprintf_l + 54 > frame #5: 0x00007ff803991fd3 libsystem_c.dylib`printf + 174 > frame #6: 0x000000010000dd1d raw_pre_gcl`error + 253 > frame #7: 0x00000001000b443c raw_pre_gcl`my_malloc + 44 > frame #8: 0x00007ff803909149 > libsystem_malloc.dylib`_malloc_zone_malloc_instrumented_or_legacy + 88 > frame #9: 0x00007ff803977ff1 libsystem_c.dylib`__smakebuf + 384 > frame #10: 0x00007ff803985b52 libsystem_c.dylib`__swsetup + 148 > frame #11: 0x00007ff803963b92 libsystem_c.dylib`__v2printf + 86 > frame #12: 0x00007ff803975912 libsystem_c.dylib`vfprintf_l + 54 > frame #13: 0x00007ff803991fd3 libsystem_c.dylib`printf + 174 > frame #14: 0x000000010000dd1d raw_pre_gcl`error + 253 > frame #15: 0x00000001000b443c raw_pre_gcl`my_malloc + 44 > frame #16: 0x00007ff803909149 > libsystem_malloc.dylib`_malloc_zone_malloc_instrumented_or_legacy + 88 > frame #17: 0x00007ff803977ff1 libsystem_c.dylib`__smakebuf + 384 > frame #18: 0x00007ff803985b52 libsystem_c.dylib`__swsetup + 148 > frame #19: 0x00007ff803963b92 libsystem_c.dylib`__v2printf + 86 > frame #20: 0x00007ff803975912 libsystem_c.dylib`vfprintf_l + 54 > frame #21: 0x00007ff803991fd3 libsystem_c.dylib`printf + 174 > frame #22: 0x000000010000dd1d raw_pre_gcl`error + 253 > frame #23: 0x00000001000b443c raw_pre_gcl`my_malloc + 44 > frame #24: 0x00007ff803909149 > libsystem_malloc.dylib`_malloc_zone_malloc_instrumented_or_legacy + 88 > > anyway, with some with some debuger using I was able to get the first > stacktrace: > > (lldb) bt > * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 > * frame #0: 0x000000010000d790 raw_pre_gcl`error > frame #1: 0x00000001000bf89c raw_pre_gcl`my_malloc + 44 > frame #2: 0x00007ff817d43abb libsystem_malloc.dylib`_malloc_zone_malloc > + 125 > frame #3: 0x00007ff817decc74 libsystem_c.dylib`__parsefloat_buf + 195 > frame #4: 0x00007ff817de3cc7 libsystem_c.dylib`__svfscanf_l + 2842 > frame #5: 0x00007ff817de3185 libsystem_c.dylib`vsscanf_l + 221 > frame #6: 0x00007ff817de9d83 libsystem_c.dylib`sscanf + 160 > frame #7: 0x000000010000ba04 raw_pre_gcl`update_real_maxpage + 436 > frame #8: 0x00000001000b6fad raw_pre_gcl`gcl_init_alloc + 589 > frame #9: 0x00000001000bf8ad raw_pre_gcl`my_malloc + 61 > frame #10: 0x00007ff817d43abb libsystem_malloc.dylib`_malloc_zone_malloc > + 125 > frame #11: 0x00007ff817decc74 libsystem_c.dylib`__parsefloat_buf + 195 > frame #12: 0x00007ff817de3cc7 libsystem_c.dylib`__svfscanf_l + 2842 > frame #13: 0x00007ff817de3185 libsystem_c.dylib`vsscanf_l + 221 > frame #14: 0x00007ff817de9d83 libsystem_c.dylib`sscanf + 160 > frame #15: 0x000000010000ba04 raw_pre_gcl`update_real_maxpage + 436 > frame #16: 0x00000001000b6fad raw_pre_gcl`gcl_init_alloc + 589 > frame #17: 0x000000010000cb90 raw_pre_gcl`main + 128 > frame #18: 0x000000010276152e dyld`start + 462 > > and if I build gcl with -g it allows to see the crash point: > > * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 > frame #0: 0x000000010000dbbc raw_pre_gcl`error(s="Bad malloc") at > main.c:687:24 > 684 void > 685 error(char *s) > 686 { > -> 687 if (catch_fatal>0 && interrupt_enable ) > 688 {catch_fatal = -1; > 689 #ifdef SGC > 690 if (sgc_enabled) > Target 0: (raw_pre_gcl) stopped. > > but any attempt to use bt leads to 100% CPU usage by LLDB. > > All of this indicates that something quite bad with memory when this ENV is > enabled. -- Camm Maguire [email protected] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah
