Skip to content

Message from debugger: Terminated due to memory issue #1

@tsr2017

Description

@tsr2017

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions