From: "Mauricio Fernández" Date: 2003-05-15T07:17:04+09:00 Subject: Re: Embedding/GC/heap corruption problem On Thu, May 15, 2003 at 06:48:22AM +0900, Simon Strandgaard wrote: > OK.. try this :-) > > void messages_init() { > message = rb_eval_string("Message.new"); > args = rb_iv_get(message, "@args"); This is not safe, as in the next line the GC might run and then message and args would be collected as they haven't been registered yet. > message_registry = rb_eval_string("MessageRegistry.instance"); > rb_gc_register_address(&message); > rb_gc_register_address(&args); > rb_gc_register_address(&message_registry); > } -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com *** PUBLIC flooding detected from erikyyy THAT's an erik, pholx.... ;) -- Seen on #LinuxGER