Search completed in 1.32 seconds.
4 results for "nsautorefcnt":
Interfacing with the XPCOM cycle collector
Mozilla › Tech › XPCOM › Interfacing with the XPCOM cycle collector
a class that you think is involved in a cyclical-ownership leak, this page is for you. The intended audience is Mozilla C++ developers. What the cycle collector does The cycle collector spends most of its time accumulating (and forgetting about) pointers to XPCOM objects that might be involved in garbage cycles. This is the idle stage of the collector's operation, in which special variants of nsAutoRefCnt register and unregister themselves very rapidly with the collector, as they pass through a "suspicious" refcount event (from N+1 to N, for nonzero N). Periodically the collector wakes up and examines any suspicious pointers that have been sitting in its buffer for a while. This is the scanning stage of the collector's operation. In this stage the collector repeatedly asks each candidate for a si...
...ctor also knows how to walk through the JS heap, and can locate ownership cycles that pass in and out of it. How the collector can fail The cycle collector is a conservative device. There are situations in which it will fail to collect a garbage cycle. It does not suspect any pointers by default; objects must suspect themselves, typically by using an nsCycleCollectingAutoRefCnt rather than a nsAutoRefCnt. It only traverses objects that return a helper object when QI'ed to nsICycleCollectionParticipant. If it encounters an unknown edge during its traversal, it gives up on that edge; this means that every edge involved in a cycle must be participating, otherwise the cycle will not be found. The Traverse and Unlink methods on the helper object are not magic; they are programmer-supplied and must b...
Index
Mozilla › Tech › XPCOM › Index
rly known as nsRefPtr, see bug 1207245) is a general class to implement reference counting pointers for objects. It is similar to nsCOMPtr, but does not require that the type be an XPCOM interface. Like with nsCOMPtr, it is the responsibility of the object itself to implement reference counting. This is done using the functions AddRef() and Release(), which respectively modify a variable of type nsAutoRefCnt, which basically is a wrapper around a count of the number of references refering to the class. 1223 nsString Class Declaration 1224 nsString external NeedsContent, Reference, Reference(2), strings Class Declaration 1225 nsStringContainer (External) NeedsContent, Reference, Reference(2), strings Class Declaration 1226 nsSu...
RefPtr
Mozilla › Tech › XPCOM › Reference › Glue classes › nsRefPtr
rly known as nsRefPtr, see bug 1207245) is a general class to implement reference counting pointers for objects. It is similar to nsCOMPtr, but does not require that the type be an XPCOM interface. Like with nsCOMPtr, it is the responsibility of the object itself to implement reference counting. This is done using the functions AddRef() and Release(), which respectively modify a variable of type nsAutoRefCnt, which basically is a wrapper around a count of the number of references refering to the class. When should I use nsCOMPtr versus RefPtr? The rules are simple: use nsCOMPtr to hold pointers to XPCOM interfaces, and use RefPtr to hold pointers to concrete class, even if the concrete class implements one or more XPCOM interfaces. So for XPCOM interfaces: nsCOMPtr<nsISupports> a; nsCOMPtr<nsIFo...
XPCOM glue classes
Mozilla › Tech › XPCOM › Reference › Glue classes
rly known as nsRefPtr, see bug 1207245) is a general class to implement reference counting pointers for objects. It is similar to nsCOMPtr, but does not require that the type be an XPCOM interface. Like with nsCOMPtr, it is the responsibility of the object itself to implement reference counting. ...