Max array size?

06 Sep 2010

Hi,

I'm trying to display an image on a screen and am storing the pixel data as chars in a large array. My problem is that the program will compile but not work when the array is bigger than 10520 elements!

Seem a little odd, does anyone have any idea what could be happening?

Cheers

Martin

06 Sep 2010

You're probably reaching the stack size limit. I am not sure if you can change it.

06 Sep 2010

Hi Martin, Igor,

It could well be you are running out of RAM; you only have a finite amount of RAM, which will get split up between the static/global data, heap and stack. They can all vary independently, but the total amount must stay under 32KB.

Also, if you want to learn more about the C memory model, you might find some useful insights on:

Another thing if this doesn't uncover anything is perhaps you could publish a program that demonstrates the problem, and someone might be able to spot something.

Thanks,

Simon

07 Sep 2010

Thanks Guys,

Pretty sure it was the stack limit. I had another array that was bigger that I was using to index the first. The combined size of both would be around the 32k mark.

Think it may be time to start looking at an SD card to store the images on?

Thanks,

Martin

07 Sep 2010

You can probably still use the flash. Just make sure you tag your image data as "const", then it will stay in flash instead of being copied to RAM.