Medusa::ValueWrapper
Inherits Reference < Object
Constructors
Instance methods
GC finalizer. We intentionally do NOT call FreeValue here.
Boehm GC runs finalizers in non-deterministic order and can trigger them during allocation inside other callbacks. If this ValueWrapper belongs to a sandbox that has already been closed, the context pointer is dangling and FreeValue would segfault.
The trade-off: JSValues with refcounts leak until their Engine is closed, at which point FreeContextAndRuntime drops everything in bulk. During normal long-lived operation (like a GUI event loop), this is fine — QuickJS's own GC handles internal object collection. The Crystal-side wrappers only hold extra refs that prevent QuickJS from collecting; once the engine shuts down, everything is freed.
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>