void RubyState::teardown() { if(rb_respond_to(_rubyObject, TeardownMethod)) { rb_funcall(_rubyObject, TeardownMethod, 0); } // Cleanup everything after teardown happens. // XXXBMW: We may want to do this in a more formalized place. Not certain. This works for now, though. rb_gc_start(); }
VALUE kernelLoadDataInt(const char *filename) { rb_gc_start(); VALUE port = fileIntForPath(filename); VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); // FIXME need to catch exceptions here with begin rescue VALUE result = rb_funcall2(marsh, rb_intern("load"), 1, &port); rb_funcall2(port, rb_intern("close"), 0, NULL); return result; }
static int load_script(int argc, char **argv) { VALUE r_argv, fname; int state, i; if (argc < 1) { return 0; } r_argv = rb_const_get(rb_mKernel, rb_intern("ARGV")); rb_ary_clear(r_argv); for (i = 1; i < argc; i++) { rb_ary_push(r_argv, rb_tainted_str_new2(argv[i])); } fname = rb_funcall(rb_cFile, ExpandPath, 1, rb_str_new2(argv[0])); rb_load_protect(fname, 1, &state); if (state) { VALUE errinfo, errstr, errat; int n, i; const char *cstr; errinfo = rb_errinfo(); errstr = rb_obj_as_string(errinfo); cstr = StringValueCStr(errstr); if (strcmp(cstr, "exit")) { ngraph_err_puts(cstr); errat = rb_funcall(errinfo, rb_intern("backtrace"), 0); if (! NIL_P(errat)) { n = RARRAY_LEN(errat); for (i = 0; i < n; i ++) { errstr = rb_str_new2("\tfrom "); rb_str_append(errstr, rb_ary_entry(errat, i)); ngraph_err_puts(StringValueCStr(errstr)); } } } } rb_gc_start(); return 0; }
static void main_loop_run2() { main_loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(main_loop); purple_core_quit(); #ifdef DEBUG_MEM_LEAK printf("QUIT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); if (im_handler == Qnil) rb_gc_unregister_address(&im_handler); if (signed_on_handler == Qnil) rb_gc_unregister_address(&signed_on_handler); if (signed_off_handler == Qnil) rb_gc_unregister_address(&signed_off_handler); if (connection_error_handler == Qnil) rb_gc_unregister_address(&connection_error_handler); if (notify_message_handler == Qnil) rb_gc_unregister_address(¬ify_message_handler); if (request_handler == Qnil) rb_gc_unregister_address(&request_handler); if (ipc_handler == Qnil) rb_gc_unregister_address(&ipc_handler); if (timer_timeout != 0) g_source_remove(timer_timeout); if (timer_handler == Qnil) rb_gc_unregister_address(&timer_handler); if (new_buddy_handler == Qnil) rb_gc_unregister_address(&new_buddy_handler); rb_gc_start(); #endif }
static void gc_start_major() { rb_gc_start(); _oobgc.stat.major++; }