I am allocating bytes using the following call in Swift 3:
let wordSize = 2
let numbytes = 1024*wordsize
var ptr = UnsafeMutableRawPointer.allocate(bytes: numbytes, alignedTo: wordSize)
Question is whether it is correct to deallocate the memory, are both these calls one and the same, or I should be using one over the other?
free(ptr) // opt 1
ptr.deallocate(bytes: numbytes, alignedTo: wordSize) //opt 2