tags:

views:

123

answers:

1

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.

+1  A: 

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.

bbum
Thanks bbum. Here is what we have discovered so far:1)There is an upper limit on the size of each {...} block. Our application exceeded that. Breaking it down into smaller blocks partially resolved this issue.2)There is an upper limit which the compiler can handle for compiling code within a single class. This limit appears to be related how much system (development platform) memory there is available. We established this by incrementally cutting out large chunks of code and commenting out anything which accessed it.
McPragma
Not usually easy, but fortunately our application architecture supports this.3)Consequently, we broke the application classes into smaller classes. The application now compiles and runs a debug build. However, it will not compile a release build, with the compiler delivering messages likeOut of memory allocating 1435327816 bytes after a total of 0 bytesThe next step will be to compile each class on its own. Just reported that that does not work.This is ridiculous. Code which would compile when part of a larger chunk will not compile when as small chunk on its own.This is not fun
McPragma
BBum ... sorry ... neglected to answer your questions. Boot drive has huge amounts of free space. Application not gigantic ... we've made larger. Bad RAM a possibility but no other symptoms in other applications. Thanks again.
McPragma
Neglected to mention that classes throwing the memory error initially, before being broken into smaller classes, would not colorize on the Xcode interface. Everything remained black and white.
McPragma