Hello Richard,

In my experience unless you know up front the maximum number of levels deep
the recursive routine is going to go, and you are confident the OS will give
you the resources, you would be safer re-designing the traversal to be
non-recursive. Recursion can be very elegant, and tempting to use, but even
on platforms with far larger stack and heap resources available (such as
windows), an unexpectedly "deep" recursive call can crash your application
due to exhaustion of resources. Having been burned a few times in the past,
we try to avoid using it.

Glenn Bachmann
Bachmann Software
http://www.bachmannsoftware.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Richard
Coutts
Sent: Saturday, July 20, 2002 2:48 PM
To: Palm Developer Forum
Subject: questions re: recursive function considerations


I have a binary tree that's pretty flat and will like only get 4-5 nodes
deep.  I've always traversed trees with a simple recursive function call
made a each branch node.  I understand that traversing in this manner is
more memory intensive than searching non-recursively, so my question is, how
many levels of recursive function calls can I make and do I need to be
concerned about memory usage if my tree is only 4-5 nodes deep?

Thanks!
Rich



--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to