Hi, At Wed, 11 Oct 2000 14:37:06 +0200 (MET DST), Robert Feldt <feldt / ce.chalmers.se> wrote: > > Can you see me the whole code which cause this error? > > > Sorry but thiss will be very difficult; it's part of a rather large system > and parts of it are proprietary so I'm not allowed to pass them on. > > If I'm able to isolate the bug I'll send it to you. In the mean time: OK. > * Is there any way I can make this happen by not handling Data_Wrap_Struct > in the right way? I have a number of extension libraries and I'm not sure > I setup the mark functions in the right way. If your struct has VALUE members, you have to mark the members by rb_gc_mark() in the mark functions. Otherwise such members will be collected as garbage. ex). struct foo { int count; VALUE obj; }; static void mark_foo(struct foo *f) { rb_gc_mark(f->obj); } static VALUE foo_s_new(VALUE self) { ... Data_Wrap_Struct(cFoo, mark_foo, free_foo, f); ... } You must not mark non-VALUE members. If the struct has no VALUE members, you don't have to set the mark function. Just specify NULL (or 0 --- matz style). Shugo