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:
MINE(foo)
repeated about a million times.
Create file2.m4 which contains:
define(`MINE',`regexp($1,`foo',`bar')')
include(`file1.m4')
Create file3.m4 which contains:
define(`MINE',`bar')
include(`file1.m4')
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
regexp.
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
CFLAGS='-g'
Thanks,
--David
_______________________________________________
Bug-m4 mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-m4