[#1551] Hashes as keys — "Nathaniel Talbott" <nathaniel@...>

I was just playing around with Hash#hash and discovered that you can't use a

13 messages 2003/09/23

Re: GC disable / enable question

From: Torsten Rueger <torsten.rueger@...>
Date: 2003-09-17 13:57:09 UTC
List: ruby-core #1538
Sorry, I was a bit ahead of myself: I don't have the code that caused  
the problem I described anymore.
I actually put references into ruby code already, and the errors I get  
are of the kind below:
But I had another look at marshal and found that it uses arrays  
differently. It creates an empty one and uses push, I create the right  
size and use the pointer to populate.
So I guess the stack trace comes from ruby misinterpreting an array  
slot.
I've now initialises the array elements to Qnil before passing the  
reference back into ruby code and it seems to work.

So thank you for you time and help and I'm sorry if I wasted any-ones  
bandwidth here,

Torsten

BTW: Code is here, but I guess not needed anymore  
http://rubyforge.org/cgi-bin/cvsweb.cgi/purple/get.c?rev=1.8&content- 
type=text/x-cvsweb-markup&cvsroot=purple

Program received signal EXC_BAD_ACCESS, Could not access memory.
rb_gc_mark (ptr=1140868132) at gc.c:625
625         if (obj->as.basic.flags == 0) return;       /* free cell */
(gdb) where
#0  rb_gc_mark (ptr=1140868132) at gc.c:625
#1  0x0001bd8c in rb_gc_mark_children (ptr=538976512) at gc.c:827
#2  0x0001b760 in rb_gc_mark (ptr=1140868132) at gc.c:642
#3  0x0001b598 in mark_keyvalue (key=538976512, value=2278400) at  
gc.c:595
#4  0x00069560 in st_foreach (table=0xe832a0, func=0x1b578  
<mark_keyvalue>, arg=0) at st.c:495
#5  0x0001bda0 in rb_gc_mark_children (ptr=538976512) at gc.c:833
#6  0x0001b760 in rb_gc_mark (ptr=1140868132) at gc.c:642
#7  0x0001b53c in mark_entry (key=538976512, value=583) at gc.c:577
#8  0x00069560 in st_foreach (table=0xe832f0, func=0x1b528  
<mark_entry>, arg=0) at st.c:495
#9  0x0001b760 in rb_gc_mark (ptr=1140868132) at gc.c:642
#10 0x0001b4f8 in mark_locations_array (x=0xbffedc44, n=178) at gc.c:555
#11 0x0001c9c4 in rb_gc () at gc.c:1242
#12 0x0001b054 in rb_newobj () at gc.c:329
#13 0x000575c4 in str_alloc (klass=2422880) at string.c:45
#14 0x00057660 in str_new (klass=538976512, ptr=0x85363c , len=79) at  
string.c:67
#15 0x002a40a0 in p_get_id (purple=2298580, arg=82385) at get.c:88


In This Thread