I am trying to covert this project into swift.
I have tried to to allocation like this
var p: [UnsafeMutablePointer?] = Array(repeating: nil, count: 10000)
var allocatedMB = 0
p[allocatedMB] = UnsafeMutablePointer.allocate(capacity: 1048576)
p[allocatedMB]?.initialize(to: 0, count: 1048576)
and
var p: [UnsafeMutableRawPointer?] = Array(repeating: nil, count: 10000)
var allocatedMB = 0
p[allocatedMB] = malloc(1048576)
memset(p[allocatedMB], 0, 1048576)
But when used memory reaches to 600MB in my app. It is getting crash and showing "Message from debugger: Terminated due to memory issue" on console.
What could be the reason for this?
As in objective C it is working as aspected.
Please assist.