Hi there, I’m getting the error Out of stack space error when I run my Lotuscript agent as a Scheduled agent however when I run it on the designer client (which is on the same server), it runs no problem.
The code is running with the following array:lateString(0 To 200,0 To 5)…is this a scheduled agent setting thing on the server document?
Thanks
Subject: redim
didn’t know redim put it in a different place…good tip that! I usually use redim but I knew what size I wanted the array matrix to be so just stuck it in the dims. I usually build there 2d arrays to take a variety of data types and it works normally…I’ll do some little tests on the redim version.
Thanks again for you input on this.
Subject: Out of stack space
Whenever that error occurred to me, it was caused by infinite recursion (a Sub or Function that calls itself recursively until the stack space is exhausted.) Could it be that your code runs into that problem when it is executed on a server, but not when it is executed in the client?
Subject: resolved…well sort of
Hi there, found it was and it still doesn’t make sense! it had problems with
Dim lateString(0 To 200,0 To 5) As Variant,
once I changed it too
Dim lateString(0 To 200,0 To 5) As String
it worked. The variant version worked on my domino 8.5 server however seems to be causing an out of stack issue on my Domino 9 one, is this a known issue??
Subject: Memory allocation
So its looks like it was the large Variant array that caused the issue. The solution you found – declaring the array as String instead of Variant – is certainly a good move. Why waste approx. 19k of precious stack space (1206 array elements x 16 Bytes per element), if less than 5k (1206 x 4 Bytes) serve the same purpose? Anyway, if you ever need a Variant array of that size, you can do it by allocating it on the heap, rather than on the stack. All you’d have to do is use ReDim instead of Dim, e.g. ReDim myArray(0 To 200, 0 To 5) As Variant.
Subject: I think it might be in the initializing
Hi Jochen, thanks for your reply. I set some console messages up so I can see what part of the code it’s failing at. I put one of these in at the start of the agent run however it’s not even getting that far before it falls over. I think it’s falling over when it gets to the dim statements.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim matrix As Variant
Dim mail_doc As NotesDocument
Dim mail_body As NotesMIMEEntity
Dim keywords_db As NotesDatabase, payrollProjectsDB As notesdatabase
Dim keywords_view As NotesView, payrollProjectsView As NotesView
Dim stream As NotesStream
Dim payroll_doc As NotesDocument, payrollProjectsDoc As notesdocument
Dim message As String
Dim testDate As Variant
Dim test As variant
Dim dayHeader As boolean
Dim i As Integer
MsgBox “1111”
Dim payRunView As NotesView
Dim PayRunDoc As NotesDocument
Dim payRunTasks(9) As String, payRunLabels(9) As String
Dim test1 As Variant, test2 As Variant, test3 As Variant
Dim earliestDate As Variant
Dim lateString(0 To 200,0 To 5) As Variant, services As String
Dim count As Integer