On 2024-10-09 10:01, mark.yagnatinsky--- via Bug reports for GNU grep wrote:
After a bit of research, it seems that once upon a time, grep used mmap where 
possible, but it no longer does this.
Thus, peak memory usage will be proportional to the length of the longest line 
in the file.
Thus, if use the "-z multiline hack" to search across lines, grep will read the 
whole file into memory.
Thus, if I try this on a huge file, I will likely have a bad time.
(e.g., a 5 gig file would fail in a 32-bit grep, and would increase memory 
pressure on the system on a 64-bit grep.)

Is the above about right?

Sounds right.

mmap likely wouldn't help much. As I recall, it typically made 'grep' slower.



Reply via email to