Not a Processing Implementations question, unless you are talking of something else than Java (in this case, you should indicate which language you use).
And AFAIK, there is not such thing as a "temporary sort file", whatever it can be. Operation that you describe should be hard on memory, not on hard disk. Although it depends on what you do in the sketch, of course (writing lot of files or big files).