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

[ios] fix memory leak in Border #15946

Merged
merged 1 commit into from
Jun 30, 2023
Merged

Commits on Jun 30, 2023

  1. [ios] fix memory leak in Border

    Context: dotnet#14664
    Context: https://github.com/nacompllo/MemoryLeakEverywhere/tree/bugfix/memoryLeakItemsSource
    
    While looking at the customer sample, we found an issue with
    `BorderHandler`:
    
    * `ContentView` -> via `LayoutSubviewsChanged`
    * `BorderHandler` ->
    * `ContentView`
    
    Creating a cycle & memory leak on iOS and Catalyst. We could reproduce
    this in a device test.
    
    It appears the event only did this:
    
        void OnLayoutSubviewsChanged(object? sender, EventArgs e)
        {
            PlatformView?.UpdateMauiCALayer();
        }
    
    And so instead, we can just call the extension method directly:
    
        this.UpdateMauiCALayer();
    
    And the leak is gone!
    
    Co-authored-by: Haritha Mohan <harithamohan@microsoft.com>
    jonathanpeppers and haritha-mohan committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    2f27351 View commit details
    Browse the repository at this point in the history