Introduce two new modes of junk filling: "alloc" and "free".

In addition to true/false, opt.junk can now be either "alloc" or "free",
giving applications the possibility of junking memory only on allocation
or deallocation.

This resolves #172.
This commit is contained in:
Guilherme Goncalves
2014-12-08 19:12:41 -02:00
committed by Jason Evans
parent b74041fb6e
commit 2c5cb613df
14 changed files with 140 additions and 72 deletions

View File

@@ -930,18 +930,20 @@ for (i = 0; i < nbins; i++) {
<varlistentry id="opt.junk">
<term>
<mallctl>opt.junk</mallctl>
(<type>bool</type>)
(<type>const char *</type>)
<literal>r-</literal>
[<option>--enable-fill</option>]
</term>
<listitem><para>Junk filling enabled/disabled. If enabled, each byte
of uninitialized allocated memory will be initialized to
<literal>0xa5</literal>. All deallocated memory will be initialized to
<literal>0x5a</literal>. This is intended for debugging and will
impact performance negatively. This option is disabled by default
unless <option>--enable-debug</option> is specified during
configuration, in which case it is enabled by default unless running
inside <ulink
<listitem><para>Junk filling. If set to "alloc", each byte of
uninitialized allocated memory will be initialized to
<literal>0xa5</literal>. If set to "free", all deallocated memory will
be initialized to <literal>0x5a</literal>. If set to "true", both
allocated and deallocated memory will be initialized, and if set to
"false", junk filling be disabled entirely. This is intended for
debugging and will impact performance negatively. This option is
"false" by default unless <option>--enable-debug</option> is specified
during configuration, in which case it is "true" by default unless
running inside <ulink
url="http://valgrind.org/">Valgrind</ulink>.</para></listitem>
</varlistentry>