.NET CLR卸载VS关机? [英] .Net CLR Unloading vs shutdown?

查看:241
本文介绍了.NET CLR卸载VS关机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是什么原因导致finalize方法被称为?

What Causes Finalize Methods to Be Called ?

2的答案(4)对这个问题有:

2 answers( of 4 ) to this question are :

  • 的CLR正在卸载一个AppDomain 当一个AppDomain卸载时,CLR认为 没有在应用程序域是根,和垃圾收集由 万代执行。

  • The CLR is unloading an AppDomain When an AppDomain unloads, the CLR considers nothing in the AppDomain to be a root, and a garbage collection consisting of all generations is performed.

的CLR正在关闭的CLR关闭,当一个进程正常终止 (相对于通过任务管理器外部关闭,例如)。

The CLR is shutting down The CLR shuts down when a process terminates normally (as opposed to an external shutdown via Task Manager, for example).

我认为的CLR正在卸载一个AppDomain 是程序(控制台[EXE]为例)被关闭(由pressing关闭/正常结束计划)

I assume that The CLR is unloading an AppDomain is when the program (console [exe] for example) is being closed ( by pressing close / normal end of program)

什么的CLR正在关闭继续上面的[EXE]程序比喻:

  • 这是什么意思?我怎样才能的关闭CLR 的...?
  • [在IIS世界]意思IIS重置?
  • what does it mean ? How can I ShutDown CLR ...?
  • [in the IIS world] does it mean IIS reset ?

请,我可以有小的解释?

please, can I have small explanation ?

推荐答案

在AppDomain比过程更精细的单位。一个进程可以可以有多个应用程序域的实例,其每一个可以单独卸载。

The AppDomain is a more granular unit than the Process. A Process can can have multiple AppDomain instances, each of which can be unloaded separately.

在CLR关机过程终止。

The CLR shutdown is the process terminating.

在AppDomain卸载是每一个单独的AppDomain

The AppDomain unloading is each AppDomain separately.

(虽然我没有亲自保证,没有检查的文件,所有的终结等在这两种情况下执行)

(although I would not personally guarantee, without checking the documentation, that all finalizers etc are executed in either case)

作为一个例子,我在一个长期运行的自我更新的Windows服务使用多个应用程序域实例;当检测到新的版本中,它拉低了新的二进制文件,产生一个新的AppDomain,得到它运行,切换未来业务新的AppDomain,并卸载旧应用程序域(运行时操作完成)。

As an example, I use multiple AppDomain instances in a long-running self-updating windows service; when new versions are detected it pulls down the new binaries, spawns a new AppDomain, gets it running, switches future operations to the new AppDomain, and unloads the old AppDomain (when running operations have completed).

这篇关于.NET CLR卸载VS关机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆