11# tracing-rc
2- [ ![ Tests] ( https://img.shields.io/github/workflow/status/Jesterhearts/tracing-rc/Tests?event=push&style=for-the-badge&label=Tests&logo=github )] ( https://github.com/Jesterhearts/tracing-rc/actions )
32[ ![ Crate] ( https://img.shields.io/crates/v/tracing-rc.svg?style=for-the-badge )] ( https://crates.io/crates/tracing-rc )
43[ ![ Docs] ( https://img.shields.io/docsrs/tracing-rc?style=for-the-badge )] ( https://docs.rs/tracing-rc )
54
@@ -41,19 +40,19 @@ In order for this crate to be sound and present a safe `Trace` trait, the collec
4140cause undefined behavior in any of the scenarios outlined. In order to accomplish this, the
4241collector does the following:
43421 . Items that are waiting for collection or have been visited during tracing are given an extra
44- strong or weak reference to make sure the memory remains allocated and the data it contains remains valid
45- even if strong references are dropped during traversal.
43+ strong or weak reference to make sure the memory remains allocated and the data it contains
44+ remains valid even if strong references are dropped during traversal.
46452 . Reference counts for traced items are not decremented by the collector during traversal (this is
4746 a difference from e.g. Bacon-Rajan which originally inspired this crate). The collector instead
4847 keeps a count of the number of times it reached each pointer through tracing, and then compares
4948 that count against the strong count for each pointer it traced to decide if the item is dead.
50493 . Before dropping any values, the collector marks the object dead. During this process, bugs in the
51- ` Trace ` implementation may cause the collector to believe a dead value is still alive
52- (causing a leak) or a live value is dead (making it inaccessible, but leaving the gc pointer
53- valid). Safe code is unable to access dead values (it will panic or return Option::None), and
54- cannot restore the live state of a dead object. Values are never temporarily dead, the collector
55- only marks them dead after it has fully determined that it is a valid candidate for collection
56- (all strong refs are from members of its cycle).
50+ ` Trace ` implementation may cause the collector to believe a dead value is still alive (causing a
51+ leak) or a live value is dead (making it inaccessible, but leaving the gc pointer valid). Safe
52+ code is unable to access dead values (it will panic or return Option::None), and cannot restore
53+ the live state of a dead object. Values are never temporarily dead, the collector only marks them
54+ dead after it has fully determined that it is a valid candidate for collection (all strong refs
55+ are from members of its cycle).
57564 . After the full set of traced objects has been marked, the collector begins dropping the inner
5857 data of objects it believes to be dead, after checking if there are any oustanding borrows
5958 (immutable or mutable). This drop _ does not_ and _ can not_ free the memory for the gc pointer,
@@ -64,8 +63,8 @@ collector does the following:
6463 reference to the ` Gc ` value, and its memory will be cleaned up. If there are remaining
6564 references, its memory will be cleaned up when the oustanding references fall out of scope.
6665
67- There are a decent number number of tests designed to exercise each of these scenarios included, and all
68- of these tests pass miri (barring leaks for intentionally misbehaved code).
66+ There are a decent number number of tests designed to exercise each of these scenarios included, and
67+ all of these tests pass miri (barring leaks for intentionally misbehaved code).
6968
7069# Example
7170``` rs
0 commit comments