[Top][All Lists]

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

possible gawk memory leak?

From: Eckard Brauer
Subject: possible gawk memory leak?
Date: Fri, 25 Jun 2021 14:32:07 +0200


playing around I just observed a little problem with gawk I can't
really explain well (gawk-5.1.0, Linux (Gentoo), x86_64). Executing

awk 'NR==4{exit}{print NR}' /dev/zero

gawk tries to allocate all available memory and so freezes the whole
host for some time. Doing that in a memory limited environment to
preserve disk swapping only let's happen the crash earlier and without
system freeze:

 $ ulimit -m 8192000
 $ ulimit -v 8192000
 $ awk 'NR==4{exit}{print NR}' /dev/zero
awk: fatal: io.c:3464:grow_iop_buffer: iop->buf: cannot reallocate 8589934593 
bytes of memory: Cannot allocate memory

So if that's not an individual problem, could you either explain the
reason(s) for that behaviour, or fix it if it's unintended?

Thanks in advance && best regards,
Eckard Brauer

reply via email to

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