Platform/Memory Reporting: Difference between revisions

Line 138: Line 138:
         return n;
         return n;
     }
     }
   
    // SizeOfIncludingThis() is inherited from B.
   };
   };


Line 148: Line 146:
* <tt>D::SizeOfExcludingThis</tt> must also call <tt>B::SizeOfExcludingThis</tt>, to ensure that any objects pointed to by fields inherited from <tt>B</tt> are measured.
* <tt>D::SizeOfExcludingThis</tt> must also call <tt>B::SizeOfExcludingThis</tt>, to ensure that any objects pointed to by fields inherited from <tt>B</tt> are measured.


* If <tt>SizeOfIncludingThis</tt> is called on a <tt>D</tt> object, control will end up in <tt>B::SizeOfIncludingThis</tt>, but its <tt>SizeOfExcludingThis()</tt> call will end up calling <tt>D::SizeOfExcludingThis</tt> (because <tt>B::SizeOfIncludingThis</tt> is <tt>virtual</tt>), even if the call was invoked via a <tt>B*</tt> pointer.  
* <tt>D::SizeOfIncludingThis</tt> is inherited from <tt>B</tt>.  The <tt>SizeOfExcludingThis()</tt> call within will be dispatched to <tt>D::SizeOfExcludingThis</tt> when appropriate (because <tt>B::SizeOfIncludingThis</tt> is <tt>virtual</tt>) which is what we want.


* The <tt>NS_MUST_OVERRIDE</tt> is an annotation that indicates that this function must be overridden by any sub-classes.  It's used by some static analysis tools.  Currently these tools aren't running, but they might in the future, and it's a useful piece of documentation.
* The <tt>NS_MUST_OVERRIDE</tt> is an annotation that indicates that this function must be overridden by any sub-classes.  It's used by some static analysis tools.  Currently these tools aren't running, but they might in the future, and it's a useful piece of documentation.
Confirmed users
1,345

edits