McPragma
McPragma

Reputation: 91

Xcode iPhone Build fails With Out of Memory

Sometimes the project compiles, and sometimes it fails with

"Out of memory allocating 4072 bytes after a total of 0 bytes"

If the project does compile, when it starts it immediately throws a bad access exception when attempting to access the first (allocated and retained) object, or, throws an error "unable to access memory address xxxxxxxx", where xxxxxxxx is a valid memory address.

Has anyone seen similar symptoms and knows of workarounds?

Thanks in advance.

Upvotes: 3

Views: 665

Answers (2)

hokkuk
hokkuk

Reputation: 675

I've seen this, it is not usually an actual memory error...(of your code)

what is happening is that you have your Xcode target Build settings "optimization level" set to Fast, or faster, or fastest..

there appears to be a bug in there somewhere, set it to none, or try the Os, or O3 (i don't think fastest is effected)..

this will very likely solve someones problem that comes across this thread. for sure try "none" first... this will confirm that this is what is happening in someone's case that sees this...

i can tell that McPragma is having this problem for sure, because he/she describes changing from debug to release, and this causes it (debug is already set to none) and release is set to something else... when that is the case... for sure it is that particular build setting...

Upvotes: 0

bbum
bbum

Reputation: 162722

If compilation or linking is failing with an out of memory error like that, it is likely one of two issues.

First, does your boot drive or the drive that you are building your source on have free space (they may be the same drive)? If not, then that error may arise when the VM subsystem tries to map in a file or, more likely if boot drive is full, the VM subsystem tries to allocate more drive for swap space.

Secondly, is your application just absolutely gigantic? I.e. is it the linker that is failing as it tries to assemble something really really large?

There is also the possibility that the system has some bad RAM in it. Unlikely, though, given that the symptoms are so consistent.

In any case, without more details, it is hard to give a more specific answer.

Upvotes: 2

Related Questions