private void EventLeak_Fixed() { for (int i = 0; i < 10; i++) { var eventListenerLeak = new EventListenerLeak("EventLeak_Fixed_" + i); eventListenerLeak.Subscribe(this); eventListenerLeak.Unsubscribe(this); } OnEventLeakProp(); }
private void EventLeakStatic_Fixed() { for (int i = 0; i < 10; i++) { var eventListenerLeak = new EventListenerLeak("EventLeakStatic_Leaked " + i); eventListenerLeak.SubscribeStatic(); eventListenerLeak.UnsubscribeStatic(); } OnEventLeakStaticProp(); }
private void EventLeak_Leaked() { for (int i = 0; i < 10; i++) { var eventListenerLeak = new EventListenerLeak("EventLeak_Leaked_" + i); eventListenerLeak.Subscribe(this); // all EventListenerLeak objects are still linked to parent object } OnEventLeakProp(); }
private void EventLeakStatic_Leaked() { for (int i = 0; i < 10; i++) { var eventListenerLeak = new EventListenerLeak("EventLeakStatic_Leaked " + i); eventListenerLeak.SubscribeStatic(); // all EventListenerLeak objects are still linked to static property } OnEventLeakStaticProp(); }