开发者

Resolving mmap error in ipad app

In my iPad live streaming app i have used 2 threads. one for collecting network data and parsing i开发者_StackOverflowt, and another for drawing logic. I am getting following error after few minutes:

malloc: * mmap(size=2097152) failed (error code=12) error: can't allocate region ** set a breakpoint in malloc_error_break to debug

So my questions are, How does this error come? how do I find it where it is coming from? And how should i resolve it?

Thank You as always.


Have you tried using the instruments tool? This should help narrow down what the issue is and if it's just a leak that needs fixing, running out of memory generally or something else going awry.

It sounds like it's just running out of memory so if it looks like it should have memory available perhaps the wierdness part is it may be out of contiguous memory and no 2Mb continuous block is available? I'm mentioning that as if you're doing multithreading alloc/deallocs you can get into a fragmentation mess easily and I'd recommend minimizing any allocs outside of the main thread if you can.

(I have to admit I'm not sure if iOS does memory virtualization like some HW can to avoid this but thought it worth mentioning just in case)

Failing all that, perhaps it's just an object locking issue if you're doing multiple allocs per thread? In which case is there any way to preallocate this 2Mb block for the thread before launching?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜