@SMcNeill ,
the stack is the least problem, as it is, QB64 is limited to 2-GB of strings, as this benchmark shows.
Unable to sort some 30 million variable-length keys is bad.
Using something like one's own "string descriptor" via MEM could solve the limitation (and the nasty string internal shuffling).
My advice to all QB64 coders is to avoid using strings, use your own structures, QB64' MEM allows using HEAP the way C does.
To me, ignoring this nasty limitation is sign of "640KB are enough" mentality.
For all coders wanting to break free, here is the full C sourcecode of Fastest SORT console tool:
http://www.sanmayce.com/Schmekeriada/index.html
Currently, when the keys exceed Physical RAM, Linux sort is far superior, in future, I have plans to dethrone Linux' sort tool in external sorting as well, my approach is more promising...
@bplus
Won't bother you again.