GC and weak events

回眸只為那壹抹淺笑 提交于 2019-12-12 03:39:38

问题


I am surprised not being able to find anything on the subject.

Garbage collection is not deterministic (it will occur some times later). Does that mean what weak event handlers may (will?) continue being called for object which is not referenced? This could be a reason of problems (performance, disposed object state, etc.), right?

If I must use weak events, is it a good idea (is it enough?) to call GC.Collect() explicitly to avoid such problems?

P.S.: I have performance problem with some software and trying to fill gaps in my knowledge before attempting something more time-consuming.

来源:https://stackoverflow.com/questions/43890059/gc-and-weak-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!