[Top][All Lists]

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

Bug report: memory leak in regexp patsubst

From: David Penry
Subject: Bug report: memory leak in regexp patsubst
Date: Fri, 29 Jun 2001 15:48:10 -0400

When using either the stable (1.4) or latest development (1.4o)
versions, the builtin functions regexp and patsubst both have a memory
leak.  This is happening because the re registers are allocated by the
call to re_compile_pattern, but are not deallocated anywhere.

There is, unfortunately, no small test case: this becomes apparent only
when using very large files.  Try the following experiment:

Create file1.m4 which contains the line:


repeated about a million times.

Create file2.m4 which contains:


Create file3.m4 which contains:


Now, the command line is:

   m4 file1.m4

You should see 'bar' repeated over and over as your output.  You should
also see the amount of memory used by the process increasing very
rapidly due to the leak.

If you try:

    m4 file3.m4

you see  MINE(foo) repeated over and over as your output, but no
excessive memory usage, which helps to narrow down the problem to the

The system upon which this was run was an IBM Thinkpad A20p running
Redhat Linux 7.1 with gcc version 2.96-81.  m4 was configured with



reply via email to

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