OF Memory Limit?

Hi All,

In my application, I seem to have hit the memory limit.
Inside my testApp object, the moment I try to declare a new data member, the application crashes with the following message:

“Program received signal: “EXC_BAD_ACCESS”.”

If I remove the data member (which is an “int”) everything runs fine. I cant proceed with the application since I need several string type members to continue.

Is the crash because I’m exceeding the stack size? Or is there a memory limitation in openFrameworks?

If there is a limit, is there a way to increase the memory, or prevent the application from crashing?

Thanks a lot in advance,
Karan

i don’t think it’s because you ran out of memory. the error must be somewhere else. you probably try to access a memory adress that is not allocated or has been freed again.
which platform are you developing for? check with the debugger what line the problem occurs. on XCode this is pretty easy.

best
joerg

it’s possible something weird is happening, like you’re accessing past the bounds of one of your arrays and the int when created is being stored right under the array, so if you declare it it breaks whatever buggy accessing you’re doing… this kind of weird stuff can happen all the time with memory… a bad access bug is definitely from something like that though and not running out of memory.

if you do run out of memory, it generates a “the program exited with status 0” error

Thanks joerg and zach for the replies.
I am sorry, my original post could have been more clear.

I am developing an app for iPhone using openFrameworks.

Now that you say it, the illegal access makes more sense that the class running out of memory.
I shall try to find out where the buggy access is taking place.

I am new to xCode, and didnt know that it can give the specific line number on which the problem is happening. Let me try and find that out too.

Thanks again.

Cheers,
karan

if you are compiling and running in debug mode it even jumps to the line where it is occuring and let’s you inspect variables etc.

best
joerg

To find the illegal memory access, i removed couple of variables. And, I just noticed that the program does give the message “Program exited with status value:0.”
Does this mean that I am crossing the memory limits? Or its because of the illegal memory access?

I am running and compiling in debug mode, and when I kill / exit the application, it just prints the message “Program exited with status value:0.” and dies, not showing me where the problem was. Is there a way to find out the section of the code where the problem is happening? If not, any pointers how to start the troubleshooting?

Thanks a lot!!!

cheers,
karan

Actually, any uncaught exception (ie. Divide by Zero, Bad Allocation, Memory Full, etc.) will cause that sort of thing to happen, excepting in programs which use a linked runtime (ie. Microsoft’s .NET crap), but that doesn’t apply here. So try using try-catch blocks looking for an Out-Of-Memory extension (which I think is different between C/C++ Standard Library and Cocoa)