bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Memory allocation problem with latest gawk - new testcase


From: Ivan Zakharyaschev
Subject: Re: Memory allocation problem with latest gawk - new testcase
Date: Thu, 3 Apr 2003 17:26:42 +0400 (MSD)

On Thu, 3 Apr 2003, Dmitry V. Levin wrote:

> > > > Problem #2: memory leak (works both on 2.2.x and 2.4.x
> kernels)

> > > Note:
> > > this testcase works as expected (endless loop) with gawk
> 3.1.1.
> >
> > I'm afraid you're not understanding what's going on.  The
> basic idea is that
> > gawk reads characters until it finds the record separator,
> by default a newline.
> > Since /dev/zero has no newlines in it, it will keep growing
> the buffer until
> > it runs out of memory.  You have limited the amount of
> memory to 16 meg or so,
> > so of course it eventually runs out of memory, and reports a
> fatal error.
> >
> > I would state that the 3.1.1 behavior is a bug, fixed in
> 3.1.2.
>
> Hereby you declare that gawk 3.1.2 cannot be used safely for
> the tasks
> where gawk 3.1.1 works?
>
> Here is one more testcase:

This test again feeds gawk with a long line. But as it can
be seen from my case with emacs, gawk wants too much memory even
when the lines are reasonably short.

> $ (gawk --version |head -1; ulimit -Sv 16384 && (yes y |tr -d
> '\n' |head -c 65536; echo n) |gawk '/y*n/ {print "found"}';
> echo rc=$?)
> GNU Awk 3.1.1
> found
> rc=0
>
> $ (gawk --version |head -1; ulimit -Sv 16384 && (yes y |tr -d
> '\n' |head -c 65536; echo n) |gawk '/y*n/ {print "found"}';
> echo rc=$?)
> GNU Awk 3.1.2
> gawk: cmd. line:2: fatal: grow_iop_buffer: iop->buf: can't
> allocate
> 16777218 bytes of memory (Cannot allocate memory)
> rc=2

Regards,
-- 
Ivan Zakharyaschev

JID: imz at altlinux.org




reply via email to

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