Out of stack space

I am getting a ‘Out of stack space’ when running an agent. Does anyone have any ideas

Thank you,

Pat Gallagher

Subject: Out of stack space

Something to remember about most procedural languages: as you enter functions or subroutines the calling function will typically “push” its temporary storage onto the stack, to be later “popped” off the stack when the called function returns. If you continuously nest functions, such as in a recursive algorithm, you can consume all of your available stack space.

For example, calling the following code will eventually consume all stack space:


Function myFunction(Byval passedInt as Integer) as Integer

Dim tempInt as Integer

tempInt = myFunction(passedInt + 1)

myFunction = tempInt

End Function


You could easily call myFunction(1) and examine the ‘passedInt’ variable to see exactly how many iterations took place before all of the stack space was gone.

The above example is “broken” by design (it never returns – ever), but it gets the point across.

Typically you can avoid killing your stack space by:

(1) Using fewer variables within the scope of your procedure – Global variables may be a good idea

(2) Combining nested procedures into one procedure

(3) Changing recursive algorithms (like the one above) to a standard loop-based algorithm (for…next, while, do, etc.)

Hope this helps!

Subject: Out of stack space

Is a java agent?

In notes.ini you can set JavaStackSize. See http://www.drcc.com/A55711/ref/notesini.nsf/all/A82BEFCC3C1BF8C986256B27004F0062

Subject: Out of stack space

Thanx folks, you all have been most helpful. I appreciate all your responses

Pat

Subject: Out of stack space

Is it a java agent?

In notes.ini you can set JavaStackSize. See http://www.drcc.com/A55711/ref/notesini.nsf/all/A82BEFCC3C1BF8C986256B27004F0062

Subject: Out of stack space

Thank you all for your responses. I appreciate it and you have been most helpful.

Subject: Recursing ?

If you are - I’ve found a max depth of about 1,800 calls - (for a function with a single integer as a parameter - more parameters means less depth).

Lotusscript isnt the best at recursion - if you are recusring, add a “level” parameter, and have it unwind if it hits ridiculous depths…

Let me guess.

:slight_smile:

Spiraling through groups and one of them has a circular reference in it ? Remember Domino stops at a group depth of six…

—* Bill

Subject: Out of stack space

Is it a java agent?

In notes.ini you can set JavaStackSize. See http://www.drcc.com/A55711/ref/notesini.nsf/all/A82BEFCC3C1BF8C986256B27004F0062