This shouldn't be something you need to worry about. The mechanism the OS uses
to handle memory per process is different from the mechanism your process uses
to allocate memory, and the OS should reclaim all the memory that your app used
(whether it was 'leaked' or not).
More info:
I’ve got one more question that bothers me.
Lets say I’ve got a class that might look something like this:
class Reference {
var pointer: UnsafeMutablePointer
init(integer: Int) {
self.pointer = UnsafeMutablePointer.alloc(1)
self.pointer.initialize(integer)
On Sat, May 21, 2016 at 2:15 AM, Adrian Zubarev via swift-users
wrote:
> So basically if I do something like this I should be on the safe side:
Yes, this code is safe. If you just want to store a contiguous buffer
of elements of the same type, you should consider using
So basically if I do something like this I should be on the safe side:
public class Characters {
private let reference: UnsafeMutablePointer
var characters: [Character] {
var characters = [Character]()
for index in