bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#73721: grep perf docs barely mention mem usage


From: Paul Eggert
Subject: bug#73721: grep perf docs barely mention mem usage
Date: Wed, 9 Oct 2024 12:03:16 -0700
User-agent: Mozilla Thunderbird

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

[Prev in Thread] Current Thread [Next in Thread]