I (and many VFP programs, I think) use an array to emulate a stack. When values are pushed into or popped from the stack, the array is re-dimensioned on the fly. The users of my program complain that the program is getting slower and slower after using for a period of time. I find that memory leak in re-dimensioning arrays may be an issue. Try the following code:
Declare a_Stack[1]
?Sys(1016)
For i=1 To 100
Dimension a_Stack[Alen(a_Stack)+1]
Dimension a_Stack[Alen(a_Stack)-1]
Next
?Sys(1016)
? Alen(a_Stack)
Every time you run the above code, you will find that more memory is used up. The only way to reclaim the memory is to issue a CLEAR ALL command.
Any idea?