Using @Formula laguage for Iterative Statements such as @For, @DoWhile, and @While will give an Error in Notes 64-bit client when an existing variable inside the loop gets updated multiple times.
"The formula has exceeded the maximum allowable memory usage (memory leak)".
For example: 4 different iterative approaches that are failing to an above error:
#1 Using For
-------
@For( i := 1 ; i <= 668 ; i := i + 1 ; @Do(
xVar := @Trim(xVar : @Text(i))
)
);
@Prompt([Ok] ; "" ; @Implode(xVar ; @NewLine));
@All;
-------
#2 Using While
-------
n := 1;
@While(n <= 668;
xVar := @Trim(xVar : @Text(n));
n := n + 1);
@Prompt([Ok] ; "" ; @Implode(xVar ; @NewLine));
@All;
-------
#3 Using DoWhile (part 1)
-------
i :=1;
@DoWhile (
i := i + 1;
xVar := @Trim(xVar : @Text(i));
i <= 668
);
@Prompt([Ok] ; "" ; @Implode(xVar ; @NewLine));
@All;
-------
#4 Using DoWhile (part 2)
-------
i :=0 ;
@DoWhile (
i := i + 1;
xVar := @Trim(xVar : @Right("000" + @Text(i) ; 3));
i <= 665
);
@Prompt([Ok] ; "" ; @Implode(xVar ; @NewLine));
@All;
-------
Notice for #1 to #3 samples, the error occurs if the maximum set is 668, however if 667, no issues.
For #4 sample, the error occurs if the maximum set is 665, however if 664, no issues.
Each loop enhances xVar, right. So the problem seems to be, that xVar requires too much memory.
So, it's not a loop issue, but a variable, that gets too big.