Magic Banana is perplexed by my experience with grep's memory usage:

> Your experience with grep is weird. As far as I understand, grep's memory requirement > do not depend on the number of lines (which could be infinite). It processes one single > line, outputs it if and only if it matches the regular expression, then forgets about
> it to process the subsequent line and so on.

My example had a pattern file of 7700 rows and a target 0f 2200 rows; the grep script
searching that combination saturated both 7.7 GB of Ram and 18 GB of swap.
I divided the 7700 rows into eight pieces of 1000 rows each (except the last one of 700 rows). Those eight grep scripts took about 20 seconds each to finish without taxing
either form of memory.

George Langford

Reply via email to