Skip to content

Conversation

@zesterer
Copy link
Owner

@zesterer zesterer commented May 25, 2025

This brings a simple benchmark down from 10.3 seconds to 9.5 seconds.

// Clone the `Thread`, unpark the clone
thread.clone().unpark();
// Forget the previously owned instance, since wake_by_ref doesn't take ownership
core::mem::forget(thread);

Choose a reason for hiding this comment

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

The clone() above will increment the reference count, but this forget prevents it from being decremented, so this will leak the Thread internals.

The clone() above has to be removed for this function to be leak-free.

Copy link
Owner Author

Choose a reason for hiding this comment

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

You are correct. If I ever get round to work on this again I'll correct this.

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.

3 participants