Class MemoryCleaner

java.lang.Object
io.github.jwharm.javagi.interop.MemoryCleaner

public class MemoryCleaner extends Object
This class keeps a cache of all memory addresses for which a Proxy object was created (except for GObject instances; those are handled in the InstanceCache).

When a cached (and owned) Proxy object is garbage-collected, the native memory is released using g_boxed_free, a custom free-function, or (as a last resort), g_free.

When ownership of a memory address transfers to native code, the cleaner will not free the memory. Take and yield ownership with takeOwnership(io.github.jwharm.javagi.base.Proxy) and yieldOwnership(io.github.jwharm.javagi.base.Proxy).