From: Rolando Abarca Date: 2009-05-07T23:09:14+09:00 Subject: Re: storing c pointers in ruby hash On May 7, 2009, at 7:15 AM, Alex Fenton wrote: > If above doesn't help, what version of 1.8 were you using > previously? If < 1.8.7 then you might see if the bug is "object > allocation during garbage collection". The size of pointers on Mac > OS X mean that when they are converted to ruby Numerics, they may be > BigNums. These are not immediate objects and involve allocation; if > you happen to do this during GC it's a mistake. Ruby 1.8.6 and > earlier were indulgent to this failing, but 1.8.7 and 1.9.1 are not. > > You could test this by placing GC.disable at the very start of your > script and seeing if the crash still happens. disabling the GC, lend me to rb_bug: :2: [BUG] Segmentation fault ruby 1.9.1p0 (2009-05-04 revision 23343) [i386-darwin9.6.0] #0 0x0010dc54 in control_frame_dump (th=0x10248e0, cfp=0xfaefd0) at / Users/rolando/Documents/GFF/ShinyCocos/ruby/vm_dump.c:108 #1 0x0010e016 in rb_vmdebug_stack_dump_raw (th=0x10248e0, cfp=0xfaefd0) at /Users/rolando/Documents/GFF/ShinyCocos/ruby/ vm_dump.c:176 #2 0x0010ea2e in rb_vm_bugreport () at /Users/rolando/Documents/GFF/ ShinyCocos/ruby/vm_dump.c:575 #3 0x00024d05 in report_bug (file=0x640014 "\034\001", line=2, fmt=0x19b143 "Segmentation fault", args=0x7e8cd4 "\213E\b\211") at / Users/rolando/Documents/GFF/ShinyCocos/ruby/error.c:215 #4 0x00024d6f in rb_bug (fmt=0x19b143 "Segmentation fault") at /Users/ rolando/Documents/GFF/ShinyCocos/ruby/error.c:230 #5 0x0009d7bc in sigsegv (sig=11, info=0x7e8fa0, ctx=0x7e8fe0) at / Users/rolando/Documents/GFF/ShinyCocos/ruby/signal.c:605 #6 #7 0x000a546c in st_lookup (table=0xdaa29, key=9864, value=0xbfffe28c) at /Users/rolando/Documents/GFF/ShinyCocos/ruby/st.c: 289 #8 0x0010475e in search_method (klass=92302780, id=9864, klassp=0x0) at vm_method.c:229 #9 0x001047a8 in rb_get_method_body (klass=92302780, id=9864, idp=0xbfffe334) at vm_method.c:256 #10 0x00106ff9 in rb_call0 (klass=92302780, recv=92302620, mid=9864, argc=0, argv=0x0, scope=1, self=6) at vm_eval.c:205 #11 0x00106ea7 in rb_call (klass=92302780, recv=92302620, mid=9864, argc=0, argv=0x0, scope=1) at vm_eval.c:255 #12 0x001072cf in rb_funcall (recv=92302620, mid=9864, n=0) at vm_eval.c:427 #13 0x000d10e2 in -[CocosNode(SC_Extension) rb_on_enter] (self=0x5778580, _cmd=0x1a75dc) at /Users/rolando/Documents/GFF/ ShinyCocos/Integration/SC_CocosNode.m:72 #14 0x00174a11 in -[CocosNode onEnter] (self=0x5778370, _cmd=0x19ca9f) at /Users/rolando/Documents/GFF/ShinyCocos/cocos2d-iphone/cocos2d/ CocosNode.m:529 #15 0x000d10ac in -[CocosNode(SC_Extension) rb_on_enter] (self=0x5778370, _cmd=0x1a75dc) at /Users/rolando/Documents/GFF/ ShinyCocos/Integration/SC_CocosNode.m:69 #16 0x00174a11 in -[CocosNode onEnter] (self=0x5775ed0, _cmd=0x19ca9f) at /Users/rolando/Documents/GFF/ShinyCocos/cocos2d-iphone/cocos2d/ CocosNode.m:529 #17 0x000d10ac in -[CocosNode(SC_Extension) rb_on_enter] (self=0x5775ed0, _cmd=0x1a75dc) at /Users/rolando/Documents/GFF/ ShinyCocos/Integration/SC_CocosNode.m:69 #18 0x00174a11 in -[CocosNode onEnter] (self=0x5775e70, _cmd=0x19ca9f) at /Users/rolando/Documents/GFF/ShinyCocos/cocos2d-iphone/cocos2d/ CocosNode.m:529 #19 0x000d10ac in -[CocosNode(SC_Extension) rb_on_enter] (self=0x5775e70, _cmd=0x1a75dc) at /Users/rolando/Documents/GFF/ ShinyCocos/Integration/SC_CocosNode.m:69 #20 0x00179386 in -[Director setNextScene] (self=0x1070fd0, _cmd=0x1a7882) at /Users/rolando/Documents/GFF/ShinyCocos/cocos2d- iphone/cocos2d/Director.m:649 #21 0x00177a13 in -[Director mainLoop] (self=0x1070fd0, _cmd=0x1a76ff) at /Users/rolando/Documents/GFF/ShinyCocos/cocos2d-iphone/cocos2d/ Director.m:185 #22 0x94505e23 in __NSFireTimer () #23 0x9213cb25 in CFRunLoopRunSpecific () #24 0x9213ccd8 in CFRunLoopRunInMode () #25 0x31566600 in GSEventRunModal () #26 0x315666c5 in GSEventRun () #27 0x30a4eca0 in -[UIApplication _run] () #28 0x30a5a09c in UIApplicationMain () #29 0x0000200a in main (argc=1, argv=0xbfffeee4) at /Users/rolando/ Documents/GFF/ShinyCocos/_DC/main.m:14 Will check a few things and try again. Btw, you were totally right, the way swig tracks objects is almost the same thing I'm trying to do. I'll take a closer look to the code. cheers, -- Rolando Abarca M.