tags:

views:

57

answers:

2

I am working on an opengl application and implementing a bezier surface in the iPhone and I am getting this:

Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.) No memory available to program now: unsafe to call malloc

and sometimes I get malloc_error_break freed sum check error... so I put a break point there but it brings not useful info for me.

I could do some optimizations but I still don't know if current implementation really work.

I am testing my application in the simulator and with very small values (4x4 control points and 16*16 for my vertices grid) and still getting malloc error?. I wonder how can I track or debug this? Most of the time I don't even get a error, the application just freezes (don't even crashes).

A: 

Sorry, it was a simple bug. My simple factorial implementation was not handling negative values giving... ;)

nacho4d
A: 

Can you explain more detail. I am in the same problem.

PhuongTh
I was trying to do a too big calculation. And malloc was failing when reaching some point.I was doing some math functions and trying to calculate a factorial of an uint in C. That is ok, but when passing a negative value the uint becomes too large and malloc fails (A negative value was no supposed to be passed, and thought I was not passing it also). I changed it to int and check before starting the operation. Very silly, but Xcode won't tell me a clue where the error/failure was. I recommend to set a breakpoint and see EACH value in EACH loop you might have and check they are as expected.
nacho4d