From: Dan Janowski Date: 2003-08-02T09:12:44+09:00 Subject: rb_raise with dynamic strings and GC Hi All, An abstract C snippet to detail my question: char *message; message = returns_error_message_that_was_malloced(); errstr = rb_str_new2(message); free(message); rb_raise(eMyError, "%s", RSTRING(errstr)->ptr); What will happen with errstr after the function returns since I did not really use it as part of an object? Will errstr be found by the GC and cleaned up? I could just use message with rb_raise, but I would rather not have a malloc being done far away and the free responsibility to be after use in the rb_raise. Is this a bad idea? Should I just use rb_exc_raise(errstr)? I love Ruby and the C extension constructs are great and clean (better than Python and Tcl from my experience). All the best, Dan -- Dan Janowski danj@3skel.com