Skip to content

Commit ede0320

Browse files
authored
Mention pitfall in ObjectTracerContext::with_tracer doc comment
1 parent 68bf1b6 commit ede0320

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/vm/scanning.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ pub trait ObjectTracerContext<VM: VMBinding>: Clone + Send + 'static {
6161

6262
/// Create a temporary `ObjectTracer` and provide access in the scope of `func`.
6363
///
64-
/// When the `ObjectTracer::trace_object` is called, if the traced object is first visited
65-
/// in this transitive closure, it will be enqueued. After `func` returns, the implememtation
66-
/// will create work packets to continue computing the transitive closure from the newly
67-
/// enqueued objects.
64+
/// A typical use-case of this method is to call `ObjectTracer::trace_object` in a loop for
65+
/// finalization candidates to create `ProcessEdgesWork` packets.
66+
//// **Note**: Do not use this API in such a way that only one object is enqueued at a time.
67+
/// This can result in creating a work packet for a single object, exhausting (physical) memory
68+
/// if there are enough finalization candidates.
69+
///
70+
/// When the `ObjectTracer::trace_object` is called, if the traced object is visited in this
71+
/// transitive closure for the first time, it will be enqueued. After `func` returns, the
72+
/// implementation will create work packets to continue computing the transitive closure from
73+
/// the newly enqueued objects.
6874
///
6975
/// API functions that provide `QueuingTracerFactory` should document
7076
/// 1. on which fields the user is supposed to call `ObjectTracer::trace_object`, and

0 commit comments

Comments
 (0)