Hi,

I am getting the following error:

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

I am using finite recursive function in my program.

Please help with my query.

Thanks

Recommended Answers

All 3 Replies

Nobody can help you if you don't post the code. Maybe your recursive function didn't know when to stop and cause stack overflow or something else just as bad. Check to see if there is something in the function that will make the recursion stop. Also make it stop after only a few recursions and see if the same error occurs.

Did you declare a pointer without allocating memory?

type_of_var *p;
p = new type_of_var; // allocate memory

We're really completely in the dark without any code.

or may be your code look like this

void foo()
{
  char* tmp = new char[1024];
  foo();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.