Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention pitfall in ObjectTracerContext::with_tracer doc comment #1259

Closed
wants to merge 1 commit into from

Conversation

k-sareen
Copy link
Collaborator

No description provided.

@k-sareen k-sareen requested a review from wks January 13, 2025 05:48
Comment on lines +64 to +68
/// 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the description is too specific to the bug you fixed recently. It's not specific to finalization (it's also applicable to SoftReference), and it is better to provide an example of the right way to use it, and then describe the consequence of flipping the order of the loop and the closure. You can leave this to me. I plan to write a dedicated porting guide section for weak references and finalizers, and update this doc comment at the same time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Thank you.

@k-sareen k-sareen closed this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants