It is possible, but definitely not recommended, and as I show you, it may change or break in the future. Why do you need this? The GC idea is definitely not worried about such things.
class Foo
def initialize
@x = 10
end
def finalize
puts "Never called"
end
end
foo = Foo.new
p foo
GC.free(Pointer(Void).new(foo.object_id))
p foo
source
share