1 31 package org.jruby; 32 33 import org.jruby.runtime.CallbackFactory; 34 import org.jruby.runtime.builtin.IRubyObject; 35 36 44 public class RubyGC { 45 public static RubyModule createGCModule(Ruby runtime) { 46 RubyModule result = runtime.defineModule("GC"); 47 CallbackFactory callbackFactory = runtime.callbackFactory(RubyGC.class); 48 49 result.defineFastModuleFunction("start", callbackFactory.getFastSingletonMethod("start")); 50 result.defineFastModuleFunction("garbage_collect", callbackFactory.getFastSingletonMethod("start")); 51 52 return result; 53 } 54 55 public static IRubyObject start(IRubyObject recv) { 56 System.gc(); 57 return recv.getRuntime().getNil(); 58 } 59 } 60 | Popular Tags |