GC and weak events

I'm surprised I couldn't find anything on this question.

Garbage collection is not deterministic (this will happen several times later). Does this mean that weak event handlers can (will?) Continue to be called on an object that is not being referenced? This could be the cause of problems (performance, object state, etc.), right?

If I have to use weak events, is it a good idea (is it enough?) To call explicitly GC.Collect()

to avoid such problems?

PS: I'm having performance issues with some software and trying to fill the gaps in my knowledge before trying something more time consuming.

0
garbage-collection c # weak-events


source to share


No one has answered this question yet

See similar questions:

3
Weak event + lambda = memory leak?

or similar:

295
How do I compare the main C # DI / IoC frameworks?
50
Why is there no reference to counting + garbage collection in C #?
fourteen
How do weak events work?
7
PCL WeakEventManager from Reactive extensions dispatches event after 3 - 7 minutes
3
How can I make sure winform is garbage collected?
2
Why inheriting from System.ComponentModel.Component doesn't allow object to be garbage collected (at all)
2
Weak events and GC
1
Weak events hang around in WPF - is this expected behavior?
1
C # language: why WeakReference or weak event pattern?
0
C #: explicit garbage collector when using event log observer



All Articles
Loading...
X
Show
Funny
Dev
Pics