Skip to content

[MacOS] Missing removeFromSuperlayer causes memory leak #333

@jason-ni

Description

@jason-ni

When investigating the multi_window memory leak issue in iced project(iced-rs/iced#3233), I see softbuffer(0.4.8) also has the same leak pattern, that is closing window doesn't release some memory resource. But unlike wgpu, it seems easy to fix in softbuffer. I just added

impl Drop for SendCALayer {
    fn drop(&mut self) {
        unsafe {
            self.0.removeFromSuperlayer();
        }
    }
}

in the cg.rs and then the leak issue solved.

But when I see that in 0.5.0 dev cycle, you are switching to IOSurface for more efficiency, I have concern that it may have similar issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - CoreGraphicsmacOS/iOS/tvOS/watchOS/visionOS backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions