The `Allocate` method has two variants:
* Allocate(size_t): Performs a normal allocation, but throws a COMException on OOM. * Allocate(ptrdiff_t offset, size_t size): Allocates a block of size `size`, and initializes a control block for an `IWeakReference` at `offset`. The weak reference resolves to the allocated object, which can finally be freed by calling `ControlBlock::ReleaseTarget`.
The IWeakReference implementation seems to be rather odd, which I have tried to demonstrate (and test) in the unit tests:
* `ReleaseTarget` only frees the object if the strong ref count is _below_ 0. * `IWeakReference::Resolve` will _not_ set the output pointer to `NULL` if the weak reference is no longer alive.
This MR implements these functions sans exception support.
-- v2: vccorlib140: Implement Platform::Details::{Allocate(ptrdiff_t, size_t), ControlBlock::ReleaseTarget}. vccorlib140: Add stub for Platform::Details::{Allocate(ptrdiff_t, size_t), ControlBlock::ReleaseTarget}.