in reply to Re: Recursion Problem
in thread Recursion Problem
Many (all?) unix implementations can only grow the process user space, never shrink it. In fact, I think that Windows* works the same way...
This is one reason to design fork()ing servers. You can have a relatively small process waiting for requests and then fork() to serve each one. As the childs terminate, their whole memory allocation is returned to the system.
It is often useful to look at the "Resident Set Size" vs the raw size of the memory allocation. The RSS is the ammount of pages/bytes that is kept in real memory and does not go out to paging/swapping. Over long periods of time, this indicator tells you how much of your allocated memory is really being used (referenced).
However, a recursive call is not necesarilly a strain in the memory subsystem, unless you have a huge number of calls. If this is the case, you should try to reduce the memory footprint of the subroutine by using as little variables local to the subroutine as possible and passing the least arguments possible to save on stack space.
Hope this helps...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Recursion Problem
by Rex(Wrecks) (Curate) on Sep 27, 2001 at 19:55 UTC |