XPCOMGC/Static Checker: Difference between revisions

storage classes
m (may => must nits)
(storage classes)
Line 15: Line 15:
** the class must not contain nsCOMPtr member variables
** the class must not contain nsCOMPtr member variables
** the class may not contain member pointers to GC objects, unless those members are annotated "safe for GC marking" <em>TODO: how to annotate?</em>
** the class may not contain member pointers to GC objects, unless those members are annotated "safe for GC marking" <em>TODO: how to annotate?</em>
Annotations are combined to find the most restrictive combination.
<table class="data">
<tr>
<th>Annotation
<th>Stack
<th>Malloc
<th>GCHeap
<th>Global
<th>Destructor is Finalizer-safe
<th>Requires Finalizer
<th>Notes
<tr>
<th>NS_STACK_CLASS
<td>
<td>No
<td>No
<td>No
<td>
<td>
<td>must only be on the stack
<tr>
<th>NS_MANAGED
<td>
<td>No
<td>
<td>No
<td>Yes
<td>
<td>Requires rooting
<tr>
<th>NS_GC_TYPE
<td>No
<td>No
<td>
<td>No
<td>Yes
<td>
<tr>
<th>NS_NOGC_TYPE
<td>
<td>
<td>No
<td>
<td>
<td>
<td>Must not appear on the GC heap
<tr>
<th>NS_GCOK
<td>
<td>
<td>
<td>
<td>Yes
<td>
<td>May be GC-allocated. Does not require finalizer
<tr>
<th>NS_GCFINALIZED_OK
<td>
<td>
<td>
<td>
<td>Yes
<td>Yes
<td>May be GC-allocated. Requires a finalizer. example: nsString
</table>
Confirmed users, Bureaucrats and Sysops emeriti
1,217

edits