Doesn't sort require keeping lines in memory as well?
In fact, doesn't sort keep all lines in memory, whereas this awk solution just keeps the unique lines.
No, most implementations of sort use a bounded memory buffer and an external-memory algorithm, spilling to disk.
I don't believe that - how does it spill to disk? TMP directory? You can still sort if you don't have any disk space (until you run out of swap?) from what I recall.
Your recollection is either limited in what implementations you have encountered, or faulty.