.net - ReactiveUI ObservableAsPropertyHelper / Reactive Extensions Memory Leak? -
i noticed in .net 3.5 application, uses reactiveui, have significant memory leak seems originate in observableaspropertyhelper. created test project demonstrate here.
it seems every change notification triggered simple observableaspropertyhelper calculated property leaks memory. leak seems originate in reactive extensions, not directly in reactiveui, use of oaph simple wonder if has encountered or may have proposed fix.
the severity of memory leak varies between .net 3.5 (rxui 2.4, rx 1.1) , .net 4.0 (rxui 4.2, rx 2.0.3). closer linear every update of property in .net 3.5. however, leak still there in .net 4.0.
i have uploaded test project , profiler images .net 3.5 , .net 4.0 test session test application, here.
you can see in images object graphs different, may talking 2 different leaks entirely. in 4.0 session (40_retentiongraph.png) can see allocated objects ints (the type of oaph property) , concurrentqueue. there seems kind of circular reference issue going on there. can see in 40_intsallocatedgcrootgrows.png distance gc root of instances grows.
in 3.5 version (which i'm concerned about), can see (35_summary.png) allocated objects action , scheduledobserver. object graph bit more complex , altogether different 40 version.
i've reviewed this discussion haven't found direct answer: scenario is, simple updates oaph. insight on possible solutions leak appreciated.
you haven't specified scheduler, default rxui going dispatcherscheduler. since app console app there no running dispatcher. memory being consumed onnext's queueing nothing run them.
you mess firing dispatcher , feeding frames run (which wpf app you), or sake of testing change reactivetester constructor this:
public reactivetester() { _total = this.whenany(x => x.a, x => x.b, (a, b) => a.value + b.value) .toproperty(this, x => x.total); }
to this:
public reactivetester() { _total = this.whenany(x => x.a, x => x.b, (a, b) => a.value + b.value) .toproperty(this, x => x.total, 0, scheduler.currentthread); }
and rosy.
Comments
Post a Comment