Package: grep
Version: 2.5.3~dfsg-3
Severity: wishlist

Hi,

I recently tried to find a string from a large hard disk image and was
surprised when grep returned "Cannot allocate memory". Apparently the
image contained so large areas of zeroes that grep ran out of memory
when I it tried to hold those areas in memory (it was probably looking
for "\n"?). My wish is that grep would use constant amount of memory
vrt. the size of input (hard disk image).

You can reproduce this problem with

$ dd if=/dev/zero bs=1M count=1k | grep x
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 4.49402 seconds, 239 MB/s
grep: (standard input): Cannot allocate memory

Note that busybox's grep handles this case just fine:

$ dd if=/dev/zero bs=1M count=1k | busybox grep x
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 349.732 seconds, 3.1 MB/s

I did these tests on an 32-bit x86 system with 4 GB of RAM. I am not
sure if this bug should be seen as a duplicate of #195719 or #358858.

best regards,
Timo Lindfors



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to