开发者

Metro style apps written in JavaScript or C++, do they load the CLR?

开发者 https://www.devze.com 2023-04-12 16:29 出处:网络
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 finish

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 yo开发者_运维百科u've activated." from MSDN.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消