02-06-2023, 07:08 PM
I have a file with over 28,000 data items. They are stored in the file in groups of 7. I have often OPENed this file, Inputed 7 items at a time and worked on each item before grabbing the next 7 data items.
The code goes
Open File
Do While Not EOF
For i = 1 to 7:Input DataItem(i): Next
Call Subroutine to work on these 7 data items
Loop
I have never had a problem looping thru the entire data file however recently I been working with Recursion and changed the routine to
Open File
Recur
Sub Recur
LoopRecur = LoopRecur + 1
Seek #1, 1
for i = 1 to 7:Input DataItem(i):Next
DataCount = DataCount + 7
Call Subroutine to work on these 7 data items
if DataCount < 4000 then Recur
End Sub
So I'm scratching my head when this recursive routine only performs 11 loops and the program just stops running. That number 11 brings to mind a possible un-dimensioned variable or perhaps a dynamic array that has gobbled up memory. I can't find anything like that in my program (which has thousands of lines of code so I could be missing it). On the other hand, could this recursive code simply be the culprit in memory munch whereas the original Do While did not munch memory?
The code goes
Open File
Do While Not EOF
For i = 1 to 7:Input DataItem(i): Next
Call Subroutine to work on these 7 data items
Loop
I have never had a problem looping thru the entire data file however recently I been working with Recursion and changed the routine to
Open File
Recur
Sub Recur
LoopRecur = LoopRecur + 1
Seek #1, 1
for i = 1 to 7:Input DataItem(i):Next
DataCount = DataCount + 7
Call Subroutine to work on these 7 data items
if DataCount < 4000 then Recur
End Sub
So I'm scratching my head when this recursive routine only performs 11 loops and the program just stops running. That number 11 brings to mind a possible un-dimensioned variable or perhaps a dynamic array that has gobbled up memory. I can't find anything like that in my program (which has thousands of lines of code so I could be missing it). On the other hand, could this recursive code simply be the culprit in memory munch whereas the original Do While did not munch memory?