If a function returns an UnsafeMutablePointer is it our responsibility to destroy and dealloc?
From Swift library UnsafeMutablePointer<T>
A pointer to an object of type
T
. This type provides no automated memory management, and therefore the user must take care to allocate and free memory appropriately.
The pointer can be in one of the following states:
- memory is not allocated (for example, pointer is null, or memory hasbeen deallocated previously);
- memory is allocated, but value has not been initialized;
- memory is allocated and value is initialized.
struct UnsafeMutablePointer<T> : RandomAccessIndexType, Hashable, NilLiteralConvertible { /**/}