Does WinRT have Garbage Collection?
Or does it do reference counting as does COM?
Does WinRT have Garbage Collection?
Or does it do reference counting as does COM?
I found this article, which cites Microsoft's Martyn Lovell:
"WinRT objects are reference counted like COM for memory management, with weak references to avoid circularity."
Apparently this was mentioned at his talk on WinRT internals at the BUILD convention.
IUnknown
. And, yes, in Metro C++ apps using the new /Zw compiler syntax, instances of ref class
types are refcounted, using AddRef
/Release
. So are strings, though they have their own refcounting functions. Compile with /FAs
and see for yourself. –
Bunko /FAs
dumps the assembly listing with source in comments, see msdn.microsoft.com/en-us/library/367y26c6(v=vs.80).aspx; /Zw
is new in VC11 and enables those language extensions –
Bunko AddRef
/Release
/QueryInterface
from you, and it also wraps HSTRING
and HRESULT
, but it doesn't try to significantly alter semantics. So, yes, it is refcounted. If you don't take my word for it, have a look at the disassembly. –
Bunko QueryInterface
(both calling and implementing it), strings, and exceptions. These all are much more concise as language extensions, and once you have those, it makes sense to move smart pointers there as well, just for the sake of more concise syntax. –
Bunko © 2022 - 2024 — McMap. All rights reserved.