The script below stops at "loop: i = 2" with the message "Out of memory" but I hardly can point out why!!!
Best,
Artur

loop i=1..3
    smpl zone=i --restrict --replace
    loop 1000 --progressive --quiet
        do some sorting
        do some estimation
        do some printing
    endloop
endloop