The memory allocation can fail, but I think Swift doesn't handle that cases. The code on github calls a non failable initializer
public convenience init?(length: Int) {
let memory = malloc(length)
self.init(bytes: memory, length: length, copy: false) { buffer, amount in
free(buffer)
}
}
EDIT: The code is from the native-Swift Foundation framework coming in Swift 3.