I have some large-ish text files (approx 8 GB each). I was having trouble comparing these files with diff under 9.1-RC2, so I did some testing with identical files. If I run [CMD="diff"]-q file1 file2[/CMD] everything is OK. But if I just run [CMD="diff"]file1 file2[/CMD] then I get various failures. On an i386 box diff runs out of address space (the error message is "diff: memory exhausted"). Even worse, on an amd64 box the process grows until swap fills up and the system starts killing processes (at random?). Eventually, the system kills "init" and then hangs. This can't be right. Why would diff need that much context when the contents are identical? Is it a bug? Or a horrible misfeature?
- Is this diff behavior necessary? Why?
- Must the system fail catastrophically just because some user process wants more memory?
- Does the system fail like this on other versions?