用 JavaScript 或 C++ 编写的 Metro 风格应用程序是否加载 CLR?
如果没有,那么 WinRT 是否有自己的垃圾收集器?
我问这个问题是因为我读到了这样的内容:“无需管理底层对象的生命周期。当您完成激活的最后一个类实例时,Windows 会释放该对象。”来自 MSDN。
If not, then does WinRT have its own Garbage Collector?
I ask this because I read this: "There's no need to manage the lifetime of underlying object. Windows releases the object when you're finished with the last of its class instances that you've activated." from MSDN.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
他们不这样做。 WinRT 不使用垃圾收集器。内存通过引用计数、IUnknown::AddRef() 和 IUnknown::Release() 进行管理。就像COM一样。不,不是 Windows 负责计数,而是语言运行时支持库。 Javascript 始终使用引用计数,C++ 从 C++/CX 语言扩展或使用智能指针类获取它。
They don't. WinRT doesn't use a garbage collector. Memory is managed with reference counting, IUnknown::AddRef() and IUnknown::Release(). Just like COM. And no, it isn't Windows that takes care of the counting, it is the language runtime support library. Javascript always used reference counting, C++ gets it from the C++/CX language extensions or by using smart pointer classes.