Question

I am getting a memory error when attempting to run an action block, I have googled it a few times and I cannot work out what is wrong?

//[self newSquareAt:location];

[self runAction:[SKAction runBlock:^{
    [self newSquareAt:location];
}]];

The uncommented line of code works ok and no error or memory allocation problems

yet when i try to run the SKAction, i get the following error:

malloc: * mach_vm_map(size=1048576) failed (error code=3) * error: can't allocate region

please help

Was it helpful?

Solution

That would be malloc being unable to allocate more memory. The way iOS works, I suspect you only get this message if you allocate lots of memory very quickly, because normally you would get a message that you are running out of memory.

Run your code under Instruments and find out where you are allocating tons of memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top