Platform/Memory Reporting: Difference between revisions

No edit summary
Line 61: Line 61:
     }
     }


[http://mxr.mozilla.org/mozilla-central/source/xpcom/base/nscore.h nscore.h] defines <tt>nsMallocSizeOfFun</tt> as follows:
[http://mxr.mozilla.org/mozilla-central/source/mfbt/MemoryReporting.h nscore.h] defines <tt>mozilla::MallocSizeOf</tt> as follows:


   typedef size_t(*nsMallocSizeOfFun)(const void *p, size_t computedSize);
   typedef size_t (*MallocSizeOf)(const void* p);


(The JS engine has a synonym called <tt>JSMallocSizeOfFun</tt>.)  Functions with this signature measure the size of <tt>p</tt> by asking the heap allocator how big it is (via <tt>moz_malloc_usable_size</tt>).
Functions with this signature measure the size of <tt>p</tt> by asking the heap allocator how big it is (via <tt>moz_malloc_usable_size</tt>).


All this is probably not what you'd expect, but the above functions have the following crucial features.
All this is probably not what you'd expect, but the above functions have the following crucial features.
Confirmed users
1,345

edits