Memory Leak Detection

Tuesday, May 15, 2018
Geoffrey Huntley

Moments ago we merged a contribution by Grzegorz Kotfis that adds another layer of protection before the project moves towards automated continuous delivery. The pull-request added a new project called ReactiveUI.LeakTests which allows the maintainers to specify tests that can determine memory leaks by checking memory usage for objects of a particular type, or tests that track memory traffic and fail in case the traffic exceeds some threshold.

In other words, the ReactiveUI unit testing harness now includes a memory profiler. We are using the free dotMemory Unit by JetBrains. It sounds complicated, but it's not. dotMemory Unit works with almost all of the unit-testing frameworks on the market including our testing framework of choice

public void Observable_Subscription_IsDisposed()
    ... // do some work

    dotMemory.Check(memory =>
        Assert.That(memory.GetObjects(where => where.Type.Is<ReactiveObject>()).ObjectsCount, Is.EqualTo(0)));

Thank-you Grzegorz!

ps. We are currently looking for folks who are interested in performance work to aide with critically accessing the performance of ReactiveUI, the Reactive Extensions for .NET and System.Linq.Expressions.

Sound interesting? Jump in, introduce yourself and ask how you can help out.