From 2679e8e9f10f2674cfa88fd7e13f7f1cea7d2172 Mon Sep 17 00:00:00 2001 From: TobBrandt-Work Date: Fri, 10 Feb 2017 15:37:54 +0100 Subject: [PATCH] EventLoopScheduler: set _nextItem to null on Tick If _queue is empty after the item is removed from it, then _nextItem is never overriden and therefore keeps a reference to item. Until another action is scheduled with a future due time, the item and all its associated state is kept in memory. --- .../Reactive/Concurrency/EventLoopScheduler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Rx.NET/Source/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs b/Rx.NET/Source/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs index 1e5b1e4b44..2e6814eadb 100644 --- a/Rx.NET/Source/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs +++ b/Rx.NET/Source/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs @@ -372,6 +372,10 @@ private void Tick(object state) if (!_disposed) { var item = (ScheduledItem)state; + if (item == _nextItem) + { + _nextItem = null; + } if (_queue.Remove(item)) { _readyList.Enqueue(item); @@ -384,4 +388,4 @@ private void Tick(object state) #endregion } -} \ No newline at end of file +}