def register_finalizer(proxy)
@@object_lock.synchronize {
@@object_id_table[proxy.__id__] = proxy.__object_id
counter = @@object_ref_counter[proxy.__object_id]
if counter then
counter += 1
else
counter = 1
end
print_debug " ----GC: #{counter} : #{proxy.__object_id}"
@@object_ref_counter[proxy.__object_id] = counter
if (!proxy.kind_of?(JObject)) then
raise RuntimeError.new("GC: different object: #{proxy.to_s}")
end
ObjectSpace.define_finalizer(proxy, JGCManager.get_finalizer_proc)
}
exec_finalizable_objects
end