Skip to content

Commit

Permalink
Mention pitfall in ObjectTracerContext::with_tracer doc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
k-sareen authored Jan 13, 2025
1 parent 68bf1b6 commit ede0320
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/vm/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ pub trait ObjectTracerContext<VM: VMBinding>: Clone + Send + 'static {

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

0 comments on commit ede0320

Please sign in to comment.