Skip to content

Drop impl of UniqueArcUninit is behind cfg(not(no_global_oom_handling)) #159651

Description

@maxdexh

While grepping the standard library in #159644, I noticed that the Drop impl for UniqueArcUninit is declared as

rust/library/alloc/src/sync.rs

Lines 4330 to 4331 in cde3f8a

#[cfg(not(no_global_oom_handling))]
impl<T: ?Sized, A: Allocator> Drop for UniqueArcUninit<T, A> {

This means that on builds with that option enabled, the memory is leaked if into_arc is not called. Note that with the way that UniqueArcUninit is currently used, this can only happen when T::clone panics in Arc::<T, A>::try_clone_from_ref_in, since the other functions that use the type are disabled too.

@rustbot label requires-nightly I-memleak A-allocators

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsC-bugCategory: This is a bug.I-memleakIssue: Runtime memory leak without `mem::forget`.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions