AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.util.MemoryLeakUtil Class Reference

Static Public Member Functions

static String trackObject (String tag, Object object)
 
static boolean isTrackedObjectCollected (String key, boolean stopTrackingIfCollected)
 
static void checkAllTrackedObjects (boolean verbose, boolean stopTrackingCollectedObjects)
 

Detailed Description

MemoryLeakUtil provides some useful methods for detecting memory leaks.

Author
lizlo.nosp@m.oney.nosp@m.@goog.nosp@m.le.c.nosp@m.om (Liz Looney)

Definition at line 23 of file MemoryLeakUtil.java.

Member Function Documentation

◆ checkAllTrackedObjects()

static void com.google.appinventor.components.runtime.util.MemoryLeakUtil.checkAllTrackedObjects ( boolean  verbose,
boolean  stopTrackingCollectedObjects 
)
static

Checks whether all tracked objects have been garbage collected, logging summary information including how many have been collected and how many have not. Optionally, it can log details showing which objects have been garbage collected and which have not.

Parameters
verbosewhether to log details about each tracked object
stopTrackingCollectedObjectswhether to stop tracking objects that have been garbage collected

Definition at line 82 of file MemoryLeakUtil.java.

◆ isTrackedObjectCollected()

static boolean com.google.appinventor.components.runtime.util.MemoryLeakUtil.isTrackedObjectCollected ( String  key,
boolean  stopTrackingIfCollected 
)
static

Checks whether a particular tracked object has been garbage collected.

Parameters
keya key returned from trackObject
stopTrackingIfCollectedwhether to stop tracking the object if it has been garbage collected
Returns
true if the tracked object has been collected; false otherwise
Exceptions
IllegalArgumentExceptionif the key is not valid

Definition at line 57 of file MemoryLeakUtil.java.

◆ trackObject()

static String com.google.appinventor.components.runtime.util.MemoryLeakUtil.trackObject ( String  tag,
Object  object 
)
static

Tracks the given Object by saving a WeakReference to it so that we can check later if it has been garbage collected.

Parameters
tagthe tag for the Object
objectthe Object to track
Returns
the key that is used to track the Object

Definition at line 40 of file MemoryLeakUtil.java.


The documentation for this class was generated from the following file: