From: Stephen Kellett Date: 2006-07-22T07:45:10+09:00 Subject: Re: GC in C extension.... In message <1153489176.647779.292870@s13g2000cwa.googlegroups.com>, "jared.r.richardson@gmail.com" writes >I think I've solved this... I assumed because the upper level arrays >were global that the contents would be safe. This was apparently not >the case. I added this line to protect the result set array > >rb_global_variable(&resultset); > >And it stopped corrupting. I think this call declares the variable to >the garbage collector so that it's aware not to clean up the contents. I was going to answer this, but it seems you've got there before I could answer. Putting your VALUEs into C global arrays does not automatically make them visible to the Ruby GC, you do need to take some action (as you have done) to make the Ruby GC aware of them to avoid unwanted collection before you need them collected. Stephen -- Stephen Kellett Object Media Limited http://www.objmedia.demon.co.uk/software.html Computer Consultancy, Software Development Windows C++, Java, Assembler, Performance Analysis, Troubleshooting