Actually sort is even better than normal (purely in-memory) merge sort. It looks at available memory and writes out sorted files to merge.
http://vkundeti.blogspot.com/2008/03/tech-algorithmic-detail...
http://vkundeti.blogspot.com/2008/03/tech-algorithmic-detail...