Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: recursive program call -> system limits exceeded


From   "Alejandro Molnar" <[email protected]>
To   [email protected]
Subject   Re: st: recursive program call -> system limits exceeded
Date   Thu, 1 Feb 2007 11:36:10 -0300 (ART)

Hi Sebastian,

The user's guide states (Version 8, p.178) that "Stata allows do-files to
be nested 64 deep". It seems like that's the limit you hit against, and
that it's due to the number of nested calls and not recursivity itself. Of
course one do-file/program may sequentially call any number of other
programs.

Cheers,
Alejandro

> Dear Statalisters,
>
> today I have been working on a little program that contains a recusive
> call to itself. While doing so I was wondering whether there is any
> practical limit. So I tried the following in a do-file
>
> global callno=0
> capture program drop recursive_test
> program define recursive_test
>      global callno=1+$callno
>      di "Call no = $callno"
>      recursive_test
> end
> recursive_test
>
> and here is the ouput (slightly abbridged)
>
>
>
>
> . global callno=0
>
> . capture program drop recursive_test
>
> . program define recursive_test
>   1.      global callno=1+$callno
>   2.      di "Call no = $callno"
>   3.      recursive_test
>   4. end
>
> . recursive_test
> Call no = 1
> Call no = 2
> Call no = 3
> ...
> ...
> ...
> Call no = 60
> Call no = 61
> Call no = 62
> Call no = 63
> system limit exceeded - see manual
> r(1000);
>
> end of do-file
> r(1000);
>
> No more than 63 recursive calls...So, I checked the manual without
> really knowing for what limit I should be looking for. Maybe someone
> has an idea.
>
> regards
> Sebastian
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index