| Age | Commit message (Collapse) | Author |
|
No functional change.
|
|
Assisted by indent(1), with manual corrections due to its many remaining
bugs.
No functional change.
|
|
No binary change, except for line numbers in assertions in suff.c.
|
|
|
|
As seen in /usr/share/misc/style.
|
|
It was only used in 2 places, and in both these places, the pointer was
never null.
|
|
Noticed by sjg.
|
|
No functional change.
|
|
None of the callers needs the HashEntry for further manipulation.
No functional change.
|
|
The documentation was wrong before since status was not restricted to
only 0 or 1.
No functional change.
|
|
Suggested by sjg, to catch more bugs like the memory leak in cond.c
1.303 from 2021-12-13.
No binary change.
|
|
The warning about unused function results would have prevented the
memory leak that was fixed in cond.c 1.303 from 2021-12-13.
|
|
No functional change.
|
|
|
|
This code is not reached, a line containing only the word "include" is
categorized as error before.
No functional change.
|
|
|
|
Assign pairs of variables in a consistent order, as far as possible.
Use string functions instead of raw byte access, to make the code more
human-readable. GCC 10 optimizes the code reasonably.
No functional change.
|
|
At the point where ParseDependencyOp is called, cp is guaranteed to
point to either ':' or '!'.
No functional change.
|
|
|
|
This gets rid of the magic numbers, making it possible to add another
debug flag without renumbering the others.
No functional change.
|
|
No functional change.
|
|
$ (
echo 'VAR=value'
perl -e 'printf(".if \${VAR}\n.endif\n" x 5000);';
echo 'all:'
printf '\t%s\n' \
'@pid=$$$$; \' \
'ppid=$$(ps -o ppid -p "$$pid" | sed 1d); \' \
'ps -o vsz,rsz -p $$ppid | sed 1d'
) > leak-cond2.mk
$ make-2004.04.08.07.24.26 -r -f leak-cond.mk
2668
$ make-2004.04.13.16.06.23 -r -f leak-cond.mk
3964
$ echo $(((3964 - 2668) * 1000 / 5000))
259
This 259 is close enough to the 256 from Buf_Init in CondParser_Leaf.
|
|
The call to Buf_DoneData was useless since ownership of the buffer data
has already been passwed on to loadedfile_create and the local variable
'buf' goes out of scope after that statement.
Except for cleaning up in debug mode, there is no reason to call
Buf_DoneData and then discard the returned value.
No functional change.
|
|
Previously, each time a .for directive pushed its buffer on the input
file stack, the current filename was duplicated. This was a waste of
memory.
The name of a file is typically only used while it is read in. There is
one situation when the filename is needed for longer, which is when a
target is defined.
Since .for loops are implemented as a special form of included files,
each .for loop duplicated the current filename as well.
$ cat << EOF > for.mk
.for i in 1 2 3 4 5 6 7 8 9 0
.for i in 1 2 3 4 5 6 7 8 9 0
.for i in 1 2 3 4 5 6 7 8 9 0
.for i in 1 2 3 4 5 6 7 8 9 0
.for i in 1 2 3 4 5 6 7 8 9 0
.for i in 1 2 3 4 5 6 7 8 9 0
.for i in 1 2 3 4 5 6 7 8 9 0
.endfor
.endfor
.endfor
.endfor
.endfor
.endfor
.endfor
all:
@ps -o rsz -p ${.MAKE.PID}
EOF
$ make-2021.12.13.03.55.16 -r -f for.mk
RSZ
10720
$ ./make -r -f for.mk
RSZ
1716
The difference is 8 MB, which amounts to 1 million .for loops.
|
|
To trigger the memory leak, the expanded variable name must not be a
prefix of the textual variable name.
textual name expanded name
ok: UNDEF.${undef} UNDEF.
leak: UNDEF.${undef}. UNDEF..
|
|
The memory allocation was in LazyBuf_DoneGet. The substring for the
untaken branch had been allocated even though it was not necessary.
No functional change.
|
|
The memory allocation was in the call to LazyBuf_DoneGet.
No functional change.
|
|
No functional change.
|
|
No functional change.
|
|
No functional change.
|
|
No functional change.
|
|
|
|
No functional change.
|
|
The newly added "variable" .SUFFIXES is short-lived as well, which makes
it necessary to distinguish between environment variables and
short-lived variables.
No binary change.
|
|
|
|
Since yesterday's addition of the short-lived "variable" named
.SUFFIXES, not only environment variables are short-lived. Clean up the
code to prepare for fixing the remaining memory leaks.
No functional change.
|
|
perl -e '
printf(".SUFFIXES: %s\n", "x" x 224);
printf("_:=\${.SUFFIXES}\n" x 100_000);
printf("all:\n");
' \
| MALLOC_CONF=stats_print:true \
./make -r -f - 2>&1 \
| awk '/bins:/,/^ *256/ { print $1 "\t" $4}'
Roughly 100000 less allocations for bin size 16, for the variable name.
|
|
|
|
Previously, each .include leaked a copy of the file name.
|
|
For symmetry with mem.
No binary change.
|
|
The only binary change is the line number of the assertion in
Substring_Sub.
|
|
This was the only use of the type MFStr, which produced the same code as
FStr.
No binary change.
|
|
No functional change.
|
|
|
|
References to ${.SUFFIXES} are handled dynamically in
ParseVarnameLong by calling Suff_NamesStr.
The variable cannot be set normally.
Reviewed by: rillig
|
|
Reviewed by: rillig
|
|
The word 'set' sounded too much like it would replace the current file,
but instead the file is pushed to the stack, and the previous file is
continued later.
No functional change.
|
|
|
|
This matches the naming style of the other ForLoop members.
No functional change.
|
|
This affects many operations on variable expressions. Those using
LazyBuf_Done are affected, those using LazyBuf_DoneGet aren't.
$ cat <<'EOF' > lazybuf-memleak.mk
.for i in ${:U:range=5}
. for j in ${:U:range=1000}
. for k in ${:U:range=1000}
. if 0 && ${VAR:Dpattern\: that needs unescaping}
. endif
. endfor
. endfor
.endfor
all:
@ps -o vsz -p ${.MAKE.PID} | sed 1d
EOF
Before using LazyBuf for the modifier ':D':
$ make-2021.04.14.16.12.26 -r -f lazybuf-memleak.mk
VSZ RSZ
1357136 1336432
Using LazyBuf for the modifier ':D':
$ make-2021.04.14.16.59.34 -r -f lazybuf-memleak.mk
VSZ RSZ
1590864 1574164
This commit alone allocates around 150 MB more data, which matches
5_000_000 strings * 30 bytes/string.
It looks very wrong that the above simple makefile uses 1.3 GB of RAM at
all, and it had already done this in 2017, long before LazyBuf was
introduced. Before 2017.01.30.02.46.20, the above test makefile reports
way smaller numbers, but that's because the modifier ':range' did not
exist back then.
|