Home > Articles > Programming > C#

.NET Reference Guide

Hosted by

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

Sorting a Large Text File

Last updated Mar 14, 2003.

In the previous section, I showed how to sort a text file that you could read entirely into memory. As useful as that is, often you’ll encounter a file that is larger than your available memory. This is especially true if you’re running on a 32-bit system because those systems are limited to an absolute maximum of 4 gigabytes of virtual memory, and the memory available to user programs is almost certainly less: probably 3 gigabytes. How, then, do you sort a 20 gigabyte file?