Confirmed users
1,345
edits
Nnethercote (talk | contribs) |
Nnethercote (talk | contribs) |
||
| Line 84: | Line 84: | ||
* Please use <tt>size_t</tt> for the sizes in functions like this. Although <tt>nsIMemoryReporter</tt> uses <tt>PRInt64</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>PRInt64</tt> as late as possible. | * Please use <tt>size_t</tt> for the sizes in functions like this. Although <tt>nsIMemoryReporter</tt> uses <tt>PRInt64</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>PRInt64</tt> as late as possible. | ||
* You don't always need both <tt>SizeOfExcludingThis</tt> and <tt>SizeOfIncludingThis</tt>. Implement one or both as needed. | * 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. | ||
And here's how you'd write a memory reporter if there was a single global MyString object. | And here's how you'd write a memory reporter if there was a single global MyString object. | ||