Thread and two dimensional array in objective C?

Posted by mactonny on Stack Overflow See other posts from Stack Overflow or by mactonny
Published on 2010-03-26T14:15:35Z Indexed on 2010/03/26 14:23 UTC
Read the original article Hit count: 512

Filed under:
|

Hey, guys, I am just starting to wrap my head around objective C and I am doing a little project on Iphone. And I just encountered a weird problem. I had to deal with images in my program so I have a lot local variables declared like temp[width][height]. If I am not using NSThread to perform image processing, it works all fine. However, if I use NSThread, it'll keep giving me EXC_BAD_ACCESS on whenever I try to access a 2-D array declared like temp[widht][height]. So I have to allocate memory from heap in order to have a 2-D array. That'll solve the problem but I still don't get it. My first thought would be stack over flow, but it worked all fine with one thread. I just don't get it.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about multithreading