Subject: bug#21527: avoiding "memory exhausted" in 2.5.4?

From: Jim Meyering <[email-masked]>
Date: Mon, 21 Sep 2015 09:02:45 +0100

On Mon, Sep 21, 2015 at 7:16 AM, Aaron Davies <[email-masked]> wrote:
> On Sep 20, 2015, at 5:47 PM, Aaron Davies <[email-masked]> wrote:
>
>> i'm trying to grep an entire volume for a short, fixed string, but no matter what i do, i keep getting "grep: memory exhausted" errors
>>
>> the only versions i have immediately available to me are 2.5.4 and and earlier; i can probably get an upgrade to the current one installed eventually, but it will take some time
>>
>> since the string is fixed, i'm using -F
>>
>> i've tried both with and without --mmap
>>
>> i've tried both a -r recursive grep and separate runs using find -print0|xargs -r0 grep
>>
>> since i'm really only interested in finding the file containing the string and if might be a binary file, i've also tried with and without -z on the theory that the problem was binaries without newlines, and NUL was more likely to occur than newline in such files (a suggestion i found online)
>>
>> none of it's helped -- they all fail with "memory exhausted" at some point
>>
>> does anyone have any other suggestions as to how to solve this? is it something fixed in a more recent grep? is there some other set of tools i could be using instead?

2.5.4 is more than 6 years old.
Please try the latest release, grep-2.21.
There have been many improvements (at least 16 stable releases) since 2.5.4.