473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

maximum possible recursion

Hi,
I want to know if we have any limit for calling any function recoursively.
If there is any, On what parameters this limit depends? and is it different
for .net 1.0, 1.1 and 2.0?
Thank you,
-yogee
Jan 4 '06 #1
5 1969
> I want to know if we have any limit for calling any function recoursively.

Yes we have.
If there is any, On what parameters this limit depends?
It depends on size and number of parameters, local variables,return types
and which expressions are used in the methods, and which kind of processor
you have (32 or 64 bit)
and is it different for .net 1.0, 1.1 and 2.0?


Yes is also dependent of the implementation of the framework.

There is no definite way to tell how much stack is free and how deep you can
recurse.
You can set the stacksize limit for each thread if you know that the size
isn't enough.
The best way would be trying to solve the problem without recursion, that is
most times possible.
Jan 4 '06 #2
Recursuion depth is limited by the thread's stack size.

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"yogee" <yo***@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
Hi,
I want to know if we have any limit for calling any function recoursively.
If there is any, On what parameters this limit depends? and is it
different
for .net 1.0, 1.1 and 2.0?
Thank you,
-yogee

Jan 4 '06 #3
Hi Yogee,

As the other repliers have stated, it depends on the thread's stack size. As
far as I know, and value types are pushed directly onto the stack along with
the call. Reference types are only passed as pointers to the object.
Therefore, it would depend on the stack memory requirements for the
parameters as well as the actual stack space allocated. I would suggest using
reference types, module-level variables or statically declared variables if
you can. Also, you may be able to reduce the actual storage requirements for
things like strings if you place them within an array instead of in
individual parameters as I believe that .net allocates pointers to arrays
rather than potentially attempting to store the actual string data within the
stack itself.

Hope this helps.

-Eric

"yogee" wrote:
Hi,
I want to know if we have any limit for calling any function recoursively.
If there is any, On what parameters this limit depends? and is it different
for .net 1.0, 1.1 and 2.0?
Thank you,
-yogee

Jan 4 '06 #4
Eric Giles <Er*******@discussions.microsoft.com> wrote:
As the other repliers have stated, it depends on the thread's stack size. As
far as I know, and value types are pushed directly onto the stack along with
the call. Reference types are only passed as pointers to the object.
Therefore, it would depend on the stack memory requirements for the
parameters as well as the actual stack space allocated. I would suggest using
reference types, module-level variables or statically declared variables if
you can.
Or trying to reduce the level of recursion...
Also, you may be able to reduce the actual storage requirements for
things like strings if you place them within an array instead of in
individual parameters as I believe that .net allocates pointers to arrays
rather than potentially attempting to store the actual string data within the
stack itself.


Strings are already reference types. The sequence of characters in a
string is never present on the stack.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 4 '06 #5
So the recursuion depth is limited by the thread's stack size ! What
exception do I need to catch if stake is full ?
And what if I create my own stakes to store parameters and other variables..
i.e. simulate process of recursion ? Is it better option than inbuilt one?
Jan 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bill Loren | last post by:
Hi ppl, Trying to substitute some html tags within a big html file using RE ended up with the "RuntimeError: maximum recursion limit exceeded" message. Any idea why that might happen and how...
1
by: Simon Burton | last post by:
Hi, I am pickling big graphs of data and running into this problem: File "/usr/lib/python2.2/pickle.py", line 225, in save f(self, object) File "/usr/lib/python2.2/pickle.py", line 414, in...
6
by: Georgy Pruss | last post by:
Sometimes I get this error. E.g. >>> sum = lambda n: n<=1 or n+sum(n-1) # just to illustrate the error >>> sum(999) 499500 >>> sum(1000) ............ RuntimeError: maximum recursion depth...
2
by: Sujit Marar | last post by:
When I run on Webware(Python application Server), there is a web Page that has a "Cancel" button , When I press the Cancel button , I get the following error based on the following code snippet...
10
by: KemperR | last post by:
Dear All, may be some of you can help me with an XSLT example how to solve the following challange. For the XML below I want to find out the maximum hierarchy level for a specific element in my...
92
by: Raghavendra R A V, CSS India | last post by:
hie.. Do any one knows how to write a C program without using the conditional statements if, for, while, do, switch, goto and even condotional statements ? It would be a great help for me if...
29
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is:...
0
by: cwig | last post by:
The following code fails: <?xml version="1.0" encoding="iso-8859-1"?> <!-- Based on a template found here: http://www.stylusstudio.com/xsllist/200303/post91230.html --> <xsl:stylesheet...
6
by: globalrev | last post by:
i received an error maximum recursion depth when processing large amounts of data. i dont know exactly how many recursive calls i made but id assume 50000 or so. is there a definitie limit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.