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 Switch #18682

Merged
merged 1 commit into from
Nov 13, 2023
Merged

Commits on Nov 10, 2023

  1. [ios] fix memory leak in Switch

    Context: dotnet#18365
    
    Adding a parameter to the test:
    
        [Theory("Handler Does Not Leak")]
        [InlineData(typeof(Switch))]
        public async Task HandlerDoesNotLeak(Type type)
    
    Shows a memory leak in `Switch`, caused by the cycle
    
    * `SwitchHandler` ->
    * `UISwitch.ValueChanged` event ->
    * `SwitchHandler`
    
    I could solve this problem by creating a `SwitchProxy` class -- the same
    pattern I've used in other PRs to avoid cycles. This makes an
    intermediate type to handle the events and breaks the cycle.
    
    Still thinking if the analyzer could have caught this, issue filed at:
    
    jonathanpeppers/memory-analyzers#12
    jonathanpeppers committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    735f03f View commit details
    Browse the repository at this point in the history