Error using recursion

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 105
Reputation: guest7 is an unknown quantity at this point 
Solved Threads: 0
guest7 guest7 is offline Offline
Junior Poster

Error using recursion

 
0
  #1
Oct 18th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,651
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1498
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: Error using recursion

 
0
  #2
Oct 18th, 2008
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 118
Reputation: chococrack is on a distinguished road 
Solved Threads: 14
chococrack's Avatar
chococrack chococrack is offline Offline
Junior Poster

Re: Error using recursion

 
0
  #3
Oct 18th, 2008
Did you declare a pointer without allocating memory?
  1. type_of_var *p;
  2. p = new type_of_var; // allocate memory

We're really completely in the dark without any code.
Last edited by chococrack; Oct 18th, 2008 at 3:23 pm.
I would love to change the world, but they won't give me the source code
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 129
Reputation: ivailosp is an unknown quantity at this point 
Solved Threads: 22
ivailosp ivailosp is offline Offline
Junior Poster

Re: Error using recursion

 
0
  #4
Oct 18th, 2008
or may be your code look like this
  1. void foo()
  2. {
  3. char* tmp = new char[1024];
  4. foo();
  5. }
Last edited by ivailosp; Oct 18th, 2008 at 3:22 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 396 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC