I noticed that in my .NET 3.5 application using ReactiveUI, I have a significant memory leak, which seems to occur in ObservableAsPropertyHelper. I created a test project to demonstrate it here .
It seems that every change notification caused by the simple computed property of the ObservableAsPropertyHelper is wasting memory. It seems that the leak comes from Reactive Extensions, and not directly into ReactiveUI, but my use of OAPH is so simple that I wonder if anyone has come across this or can offer a suggested fix.
The severity of a memory leak varies between .NET 3.5 (RxUI 2.4, Rx 1.1) and .NET 4.0 (RxUI 4.2, Rx 2.0.3). This is much closer to linear with every property update in .NET 3.5. However, the leak still exists in .NET 4.0.
I downloaded a test project and some profiler images for my test session .NET 3.5 and .NET 4.0 with the test application here .
In the images you can see that the graphs of the objects are different, so we can talk about two different leaks entirely. In the 4.0 session (40_RetentionGraph.png), you can see that the most highlighted objects are Ints (my property type is OAPH) and ConcurrentQueue. It seems that there is some kind of round reference question. You can also see in 40_IntsAllocatedGCRootGrows.png that the distance from the GC root from the instances is increasing.
In version 3.5 (which bothers me the most), you can see (35_Summary.png) that the most highlighted objects are Action and ScheduledObserver. The graph of the object is a bit more complicated and differs from version 40.
I looked through this discussion but did not find a direct answer: my scenario is very simple updates for OAPH. Any understanding of possible solutions to this leak is appreciated.
source share