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


source to share





All Articles