View Full Version : Too many variables in procedure?
dwalden74 12-29-2002, 01:18 PM I just got this warning message in a script I´m working on:
// Warning: line 1: Too many variables in this procedure to properly handle recursion. //
Anybody know what it means and/or if it could be a problem? The script still sources and runs no problem.
:beer:
David
|
|
dmeyer
12-29-2002, 07:59 PM
Try searching the archives at highend3d.com
There are many MEL gods that answer questions such as these constantly (including none other than Mr. Brinsmead himself). :beer:
MDuffy
01-02-2003, 11:35 PM
Recursion means your script is calling itself. Every time your script is called, it has to allocate memory for its local variables, usually on something called a "stack". Assuming MEL uses a stack for local variables, then you can only call your routine so many times before you run out of stack memory.
Your best bet would be to change your script so that it doesn't call itself.
Hope this helps,
Michael Duffy
mduffy@ionet.net
I had this error few week ago.
It means that you have declared too many variables in the procedure.
you can:
- divide this big procedure into smallers
- or declare less variables in it.
Hope that helps,
Klod
dwalden74
01-03-2003, 09:39 AM
Yeah, I ended up removing a chunk of it and putting it into its own proc.
MDuffy, when you say that the procedure is "calling itself", do you mean that it calls other procedures in the same script file or what? Not sure I understand this completely...
:beer:
David
MDuffy
01-03-2003, 04:10 PM
It sounds like your problem was having too many variables, not being recursive. A recursive routine is one that calls itself. Let's say that you call a routine with a list of objects, then that routine finds the children of each object passed, and calls itself with the list of children. That would be recursive.
global proc RecursiveFunc (string $listObjects [])
{
// step through each object in the list.
for ($objCurr in $listObjects)
{
// print the name of the object
print ($objCurr + "\n");
// recurse through the children and print their names
string $listChildren [] = `listRelatives -c $objCurr`;
RecursiveFunc ($listChildren);
}
}
Also a function is recursive if it winds up calling itself indirectly. For example in the above sample, if it called FunctionA () instead of RecursiveFunc (), but FunctionA winds up calling RecursiveFunc somewhere inside it, then you have a recursive situation.
Later,
Michael Duffy
mduffy@ionet.net
dwalden74
01-03-2003, 08:03 PM
ah yeah, thanks.
-David
CGTalk Moderation
01-14-2006, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.