Object Watcher
ObjectWatcher can be passed objects to watch. It will create KeyedWeakReference instances that reference watches objects, and check if those references have been cleared as expected on the checkRetainedExecutor executor. If not, these objects are considered retained and ObjectWatcher will then notify registered OnObjectRetainedListeners on that executor thread.
checkRetainedExecutor is expected to run its tasks on a background thread, with a significant delay to give the GC the opportunity to identify weakly reachable objects.
ObjectWatcher is thread safe.
Constructors
Functions
Clears all KeyedWeakReference that were created before heapDumpUptimeMillis (based on clock)
Clears all KeyedWeakReference
Expects the provided watchedObject to become weakly reachable soon. If not, watchedObject will be considered retained.