Platform/Memory Reporting: Difference between revisions

Line 77: Line 77:
Some other things to note:
Some other things to note:


* Please use <tt>size_t</tt> for the sizes in functions like this. Although <tt>nsIMemoryReporter</tt> uses <tt>int64_t</tt>, this is only because you can't use <tt>size_t</tt> in IDL.  So it's best to mostly use <tt>size_t</tt> and convert to <tt>int64_t</tt> as late as possible.
* Please use <tt>size_t</tt> for the sizes in functions like this. Although <tt>nsIMemoryReporter</tt> uses <tt>int64_t</tt>, this is because (a) you can't use <tt>size_t</tt> in IDL, and (b) not every "amount" is a bytes measurement.  So it's best to mostly use <tt>size_t</tt> and convert to <tt>int64_t</tt> as late as possible.


* You don't always need both <tt>SizeOfExcludingThis</tt> and <tt>SizeOfIncludingThis</tt>.  Implement one or both as needed.  If you have both, <tt>SizeOfExcludingThis</tt> is the interesting one;  <tt>SizeOfIncludingThis</tt> always has the same basic form.
* You don't always need both <tt>SizeOfExcludingThis</tt> and <tt>SizeOfIncludingThis</tt>.  Implement one or both as needed.  If you have both, <tt>SizeOfExcludingThis</tt> is the interesting one;  <tt>SizeOfIncludingThis</tt> always has the same basic form.
Confirmed users
1,345

edits