You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Memory leak in map/filter_map for Owned* guards #63
When revisiting the implementation while preparing to add downgrade(), I found Arc strong-reference leaks in map/filter_map of three owned mapped guards. The bug was introduced by using ManuallyDrop together with Arc::clone(), which leaves the original strong reference stranded in ManuallyDrop and never dropped. This bug was caused by my attempt to prevent the original Guard from releasing its lock and to preserve the Arc reference that provides the lock for the MappedGuard. In fact, I should have transferred ownership of the Arc instead of sharing it.
I am very sorry for writing incorrect Unsafe Rust code. I will fix this issue.
Suggested Fix
I will submit a Pull Request that replaces guard.lock.clone() with unsafe { std::ptr::read(&guard.lock) } in all affected map and filter_map methods. The PR will also include the new tests.
Activity