Labs/Jetpack/JEP/28: Difference between revisions

→‎memory: updated
(→‎memory: updated to reflect latest changes to code)
(→‎memory: updated)
Line 106: Line 106:
<tt>memory.'''track'''(''object'', [''bin''])</tt>
<tt>memory.'''track'''(''object'', [''bin''])</tt>


Marks ''object'' for being tracked, and categorizes it with the given bin name. If ''bin'' isn't specified, the memory tracker attempts to infer a bin name by first checking the object's <tt>constructor.name</tt>; if that fails or results in the generic <tt>Object</tt>, the stack is inspected and the name of the current function being executed&mdash;which is assumed to be a constructor function&mdash;is used.
Marks ''object'' for being tracked, and categorizes it with the given bin name. If ''bin'' isn't specified, the memory tracker attempts to infer a bin name by first checking the object's <tt>constructor.name</tt>; if that fails or results in the generic <tt>Object</tt>, the stack is inspected and the name of the current function being executed&mdash;which is assumed to be a constructor function&mdash;is used. If that fails, then the object is placed in a bin named <tt>generic</tt>.


<tt>memory.'''getObjects'''([''bin''])</tt>
<tt>memory.'''getObjects'''([''bin''])</tt>
Line 114: Line 114:
<tt>memory.'''getBins'''()</tt>
<tt>memory.'''getBins'''()</tt>


Returns an <tt>Array</tt> of all non-empty bin names.
Returns an <tt>Array</tt> containing the names of all bins that aren't currently empty.


== Modules ==
== Modules ==
874

edits