Platform/Memory Reporting: Difference between revisions

Jump to navigation Jump to search
Line 76: Line 76:
* On platforms that allow it, they count the actual memory in use, including slop bytes caused by the heap allocator rounding up request sizes (a.k.a. internal fragmentation).  If slop bytes aren't measured they'll end up in about:memory's <tt>heap-unclassified</tt> entry, which is bad.
* On platforms that allow it, they count the actual memory in use, including slop bytes caused by the heap allocator rounding up request sizes (a.k.a. internal fragmentation).  If slop bytes aren't measured they'll end up in about:memory's <tt>heap-unclassified</tt> entry, which is bad.


* They provide a computed size as well, which serves two purposes.
* They provide a computed size as well. On platforms that cannot measure actual memory in use, this serves as a fallback.
** On platforms that cannot measure actual memory in use, this serves as a fallback.
** On other platforms, the computed and actual sizes can be compared and if they differ sufficiently an assertion fails.  This sanity checking has caught multiple bugs in existing memory reporters.


* They are flexible and integrate well with DMD.  The <tt>aMallocSizeOf</tt> parameter allows <tt>nsMallocSizeOfFun</tt> functions with DMD-specific hooks to be passed in when they are used by memory reporters, but functions without such hooks (such as <tt>moz_malloc_size_of</tt>) can also be passed in when they are used in other circumstances.
* They are flexible and integrate well with DMD.  The <tt>aMallocSizeOf</tt> parameter allows <tt>nsMallocSizeOfFun</tt> functions with DMD-specific hooks to be passed in when they are used by memory reporters, but functions without such hooks (such as <tt>moz_malloc_size_of</tt>) can also be passed in when they are used in other circumstances.
Confirmed users
1,345

edits

Navigation menu