user4059727
user4059727

Reputation: 1

Use all available memory on iPad

I'm trying to make an app that uses all the available memory on an iPad to intentionally bog it down so I can test a few other things when there is limited memory.

Currently I'm using this code which works, but Xcode stops me short with an error that I can't allocate the region. (Stops me at roughly 1.4/4 GB.)

while(1)
{
    void *m = malloc(1024*1024);
    memset(m,0,1024*1024);
}

I want to use all the memory I can, and hold onto that memory until I say to stop. Is there a better way to go about this?

Upvotes: 0

Views: 75

Answers (1)

user1641854
user1641854

Reputation:

Try to use mmap with MAP_LOCKED

Upvotes: 1

Related Questions