c# - Reactive Extensions memory usage -
I use the reactive extension for the following code net in a WPF application: Is the mouse running on this dialogue, while there will be a steady increase of memory? Reading the code, I hope that after some time there will be a large amount of MouseAventArgues in the invoice view? Or is it handled in some smart way I am unaware of?
Public Manvindo () {Initialization (); Up left ButtonDown = Observable.FromEvent & LT; MouseButtonEventArgs & gt; (This, "MouseLeftButtonDown"); Var leftButtonUp = Observable.FromEvent & lt; MouseButtonEventArgs & gt; (This, "MouseLeftButtonUp"); MoveAvents = Observable.FromEvent & LT; MouseEventArgs & gt; (This, "MouseMove") .SkipUntil (leftButtonDown) .SkipUntil (leftButtonUp) .repeat () .Select (T = & gt; t.EventArgs.GetPosition (this)); MoveEvents.Subscribe (point => {textBox1.Text = String.Format (String.Format ("X: {0}, Y: {1}", point.X, point.Y));}); }
No, there should not be a constant increase in memory usage - why? Events are originally flown to the customer; They are not being buffer up anywhere
The thing of RX is that the events are pushed to the customer, what can they choose to do with them. This is not like adding an event to a list, which is examined later.
(There are ways to buffering events in Rx, but as you can tell, you are not using them.)
Comments
Post a Comment