addCleaner

open override fun addCleaner(cleaner: <Error class: unknown class>): Boolean(source)

Registers a cleaner to be executed when this proxy object is garbage collected.

  • A cleaner allows for resource cleanup when the object is no longer used.

  • If the cleaner is not explicitly stored, it may be garbage collected early, leading to unexpected behavior.

Return

true if the cleaner was successfully added, false if it was already registered.

Parameters

cleaner

The Cleaner instance to associate with this object.