mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Remove ISC_MEM_DEBUGSIZE and ISC_MEM_DEBUGRECORD
The ISC_MEM_DEBUGSIZE and ISC_MEM_DEBUGCTX did sanity checks on matching size and memory context on the memory returned to the allocator. Those will no longer needed when most of the allocator will be replaced with jemalloc.
This commit is contained in:
@@ -611,12 +611,6 @@ main(int argc, char **argv) {
|
|||||||
{
|
{
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||||
}
|
}
|
||||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
|
||||||
}
|
|
||||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -909,12 +909,6 @@ main(int argc, char **argv) {
|
|||||||
{
|
{
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||||
}
|
}
|
||||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
|
||||||
}
|
|
||||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -3335,12 +3335,6 @@ main(int argc, char *argv[]) {
|
|||||||
{
|
{
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||||
}
|
}
|
||||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
|
||||||
}
|
|
||||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -209,12 +209,6 @@ main(int argc, char *argv[]) {
|
|||||||
{
|
{
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||||
}
|
}
|
||||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
|
||||||
}
|
|
||||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -430,8 +430,6 @@ static struct flag_def {
|
|||||||
{ "trace", ISC_MEM_DEBUGTRACE, false },
|
{ "trace", ISC_MEM_DEBUGTRACE, false },
|
||||||
{ "record", ISC_MEM_DEBUGRECORD, false },
|
{ "record", ISC_MEM_DEBUGRECORD, false },
|
||||||
{ "usage", ISC_MEM_DEBUGUSAGE, false },
|
{ "usage", ISC_MEM_DEBUGUSAGE, false },
|
||||||
{ "size", ISC_MEM_DEBUGSIZE, false },
|
|
||||||
{ "mctx", ISC_MEM_DEBUGCTX, false },
|
|
||||||
{ NULL, 0, false } },
|
{ NULL, 0, false } },
|
||||||
mem_context_flags[] = { { "fill", ISC_MEMFLAG_FILL, false },
|
mem_context_flags[] = { { "fill", ISC_MEMFLAG_FILL, false },
|
||||||
{ "nofill", ISC_MEMFLAG_FILL, true },
|
{ "nofill", ISC_MEMFLAG_FILL, true },
|
||||||
|
@@ -546,7 +546,7 @@ By default, start.pl starts a "named" server with the following options:
|
|||||||
-g Runs the server in the foreground and logs everything to
|
-g Runs the server in the foreground and logs everything to
|
||||||
stderr.
|
stderr.
|
||||||
|
|
||||||
-m record,size,mctx
|
-m record
|
||||||
Turns on these memory usage debugging flags.
|
Turns on these memory usage debugging flags.
|
||||||
|
|
||||||
-U 4 Uses four listeners.
|
-U 4 Uses four listeners.
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
# this server runs named with only one worker thread
|
# this server runs named with only one worker thread
|
||||||
-m record,size,mctx -c named.conf -d 99 -D additional-ns1 -X named.lock -g -n 1 -T maxcachesize=2097152
|
-m record -c named.conf -d 99 -D additional-ns1 -X named.lock -g -n 1 -T maxcachesize=2097152
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
# this server only has 127.0.0.1 in its localhost/localnets ACLs
|
# this server only has 127.0.0.1 in its localhost/localnets ACLs
|
||||||
-m record,size,mctx -c named.conf -d 99 -D allow-query-ns3 -X named.lock -g -T maxcachesize=2097152 -T fixedlocal
|
-m record -c named.conf -d 99 -D allow-query-ns3 -X named.lock -g -T maxcachesize=2097152 -T fixedlocal
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 1 -D cacheclean-ns1 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 1 -D cacheclean-ns1 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 3 -D cacheclean-ns2 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 3 -D cacheclean-ns2 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-D delzone-ns2 -X named.lock -m record,size,mctx -c named.conf -g -U 4 -T maxcachesize=2097152
|
-D delzone-ns2 -X named.lock -m record -c named.conf -g -U 4 -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dnssec-ns6 -X named.lock -g -T maxcachesize=2097152 -T nonearest -T tat=1
|
-m record -c named.conf -d 99 -D dnssec-ns6 -X named.lock -g -T maxcachesize=2097152 -T nonearest -T tat=1
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
# Using "-n 1" allows GL #1795 to be reliably reproduced
|
# Using "-n 1" allows GL #1795 to be reliably reproduced
|
||||||
-D dnstap-ns3 -X named.lock -m record,size,mctx -c named.conf -d 99 -g -U 4 -n 1 -T maxcachesize=2097152
|
-D dnstap-ns3 -X named.lock -m record -c named.conf -d 99 -g -U 4 -n 1 -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns1 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns1 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns2 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns2 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns3 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns3 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns4 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns4 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns5 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns5 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns6 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns6 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D dscp-ns7 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
-m record -c named.conf -d 99 -D dscp-ns7 -X named.lock -g -U 4 -T maxcachesize=2097152 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-D dupsigs-ns1 -X named.lock -m record,size,mctx -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152 -T sigvalinsecs
|
-D dupsigs-ns1 -X named.lock -m record -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152 -T sigvalinsecs
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 1 -D fetchlimit-ns3 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 1 -D fetchlimit-ns3 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D legacy-ns4 -X named.lock -g -U 4 -T maxcachesize=2097152 -T noedns
|
-m record -c named.conf -d 99 -D legacy-ns4 -X named.lock -g -U 4 -T maxcachesize=2097152 -T noedns
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D legacy-ns5 -X named.lock -g -U 4 -T maxcachesize=2097152 -T noedns
|
-m record -c named.conf -d 99 -D legacy-ns5 -X named.lock -g -U 4 -T maxcachesize=2097152 -T noedns
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D legacy-ns6 -X named.lock -g -U 4 -T maxcachesize=2097152 -T maxudp512
|
-m record -c named.conf -d 99 -D legacy-ns6 -X named.lock -g -U 4 -T maxcachesize=2097152 -T maxudp512
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D legacy-ns7 -X named.lock -g -U 4 -T maxcachesize=2097152 -T maxudp512
|
-m record -c named.conf -d 99 -D legacy-ns7 -X named.lock -g -U 4 -T maxcachesize=2097152 -T maxudp512
|
||||||
|
@@ -35,7 +35,7 @@ DLFILE="named_deflog"
|
|||||||
|
|
||||||
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
|
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
|
||||||
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
|
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
|
||||||
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T nosyslog -d 99 -D logfileconfig-ns1 -X named.lock -U 4"
|
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record -T nosyslog -d 99 -D logfileconfig-ns1 -X named.lock -U 4"
|
||||||
|
|
||||||
# Test given condition. If true, test again after a second. Used for testing
|
# Test given condition. If true, test again after a second. Used for testing
|
||||||
# filesystem-dependent conditions in order to prevent false negatives caused by
|
# filesystem-dependent conditions in order to prevent false negatives caused by
|
||||||
|
@@ -1 +1 @@
|
|||||||
-D mirror-ns3 -X named.lock -m record,size,mctx -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152 -T tat=3
|
-D mirror-ns3 -X named.lock -m record -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152 -T tat=3
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D mkeys-ns2 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=5/10/20 -T tat=1
|
-m record -c named.conf -d 99 -D mkeys-ns2 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=5/10/20 -T tat=1
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D mkeys-ns3 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=5/10/20
|
-m record -c named.conf -d 99 -D mkeys-ns3 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=5/10/20
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 99 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=2/20/40
|
-m record -c named.conf -d 99 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=2/20/40
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=5/10/20
|
-m record -c named.conf -d 99 -X named.lock -g -T maxcachesize=2097152 -T mkeytimers=5/10/20
|
||||||
|
@@ -1 +1 @@
|
|||||||
-D nsupdate-ns5 -m record,size,mctx -c named.conf -d 99 -X named.lock -g -U 4 -T maxcachesize=2097152 -T fixedlocal
|
-D nsupdate-ns5 -m record -c named.conf -d 99 -X named.lock -g -U 4 -T maxcachesize=2097152 -T fixedlocal
|
||||||
|
@@ -1 +1 @@
|
|||||||
-D nsupdate-ns6 -m record,size,mctx -c named.conf -d 99 -X named.lock -g -U 4 -T maxcachesize=2097152 -T fixedlocal
|
-D nsupdate-ns6 -m record -c named.conf -d 99 -X named.lock -g -U 4 -T maxcachesize=2097152 -T fixedlocal
|
||||||
|
@@ -833,7 +833,7 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "check logged command line ($n)"
|
echo_i "check logged command line ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
grep "running as: .* -m record,size,mctx " ns1/named.run > /dev/null || ret=1
|
grep "running as: .* -m record " ns1/named.run > /dev/null || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -D rpzextra-ns1 -X named.lock -U 4 -T maxcachesize=2097152
|
-m record -c named.conf -d 99 -D rpzextra-ns1 -X named.lock -U 4 -T maxcachesize=2097152
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
|
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
|
||||||
NAMED_DEFAULT_ARGS="-m record,size,mctx -d 99 -g -U 4"
|
NAMED_DEFAULT_ARGS="-m record -d 99 -g -U 4"
|
||||||
|
|
||||||
kill_named() {
|
kill_named() {
|
||||||
pidfile="${1}"
|
pidfile="${1}"
|
||||||
|
@@ -267,7 +267,7 @@ sub construct_ns_command {
|
|||||||
} else {
|
} else {
|
||||||
$command .= "-D $test-$server ";
|
$command .= "-D $test-$server ";
|
||||||
$command .= "-X named.lock ";
|
$command .= "-X named.lock ";
|
||||||
$command .= "-m record,size,mctx ";
|
$command .= "-m record ";
|
||||||
|
|
||||||
foreach my $t_option(
|
foreach my $t_option(
|
||||||
"dropedns", "ednsformerr", "ednsnotimp", "ednsrefused",
|
"dropedns", "ednsformerr", "ednsnotimp", "ednsrefused",
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 1 -D timeouts-ns1 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 1 -D timeouts-ns1 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 1 -D zero-ns2 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 1 -D zero-ns2 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 1 -D zero-ns3 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 1 -D zero-ns3 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 1 -D zero-ns4 -X named.lock -g -T maxcachesize=2097152
|
-m record -c named.conf -d 1 -D zero-ns4 -X named.lock -g -T maxcachesize=2097152
|
||||||
|
@@ -130,12 +130,6 @@ main(int argc, char *argv[]) {
|
|||||||
{
|
{
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
|
||||||
}
|
}
|
||||||
if (strcasecmp(isc_commandline_argument, "size") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
|
|
||||||
}
|
|
||||||
if (strcasecmp(isc_commandline_argument, "mctx") == 0) {
|
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGCTX;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -43,8 +43,6 @@ extern unsigned int isc_mem_defaultflags;
|
|||||||
#define ISC_MEM_DEBUGTRACE 0x00000001U
|
#define ISC_MEM_DEBUGTRACE 0x00000001U
|
||||||
#define ISC_MEM_DEBUGRECORD 0x00000002U
|
#define ISC_MEM_DEBUGRECORD 0x00000002U
|
||||||
#define ISC_MEM_DEBUGUSAGE 0x00000004U
|
#define ISC_MEM_DEBUGUSAGE 0x00000004U
|
||||||
#define ISC_MEM_DEBUGSIZE 0x00000008U
|
|
||||||
#define ISC_MEM_DEBUGCTX 0x00000010U
|
|
||||||
#define ISC_MEM_DEBUGALL 0x0000001FU
|
#define ISC_MEM_DEBUGALL 0x0000001FU
|
||||||
/*!<
|
/*!<
|
||||||
* The variable isc_mem_debugging holds a set of flags for
|
* The variable isc_mem_debugging holds a set of flags for
|
||||||
@@ -63,14 +61,6 @@ extern unsigned int isc_mem_defaultflags;
|
|||||||
* \li #ISC_MEM_DEBUGUSAGE
|
* \li #ISC_MEM_DEBUGUSAGE
|
||||||
* If a hi_water mark is set, print the maximum inuse memory
|
* If a hi_water mark is set, print the maximum inuse memory
|
||||||
* every time it is raised once it exceeds the hi_water mark.
|
* every time it is raised once it exceeds the hi_water mark.
|
||||||
*
|
|
||||||
* \li #ISC_MEM_DEBUGSIZE
|
|
||||||
* Check the size argument being passed to isc_mem_put() matches
|
|
||||||
* that passed to isc_mem_get().
|
|
||||||
*
|
|
||||||
* \li #ISC_MEM_DEBUGCTX
|
|
||||||
* Check the mctx argument being passed to isc_mem_put() matches
|
|
||||||
* that passed to isc_mem_get().
|
|
||||||
*/
|
*/
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
@@ -604,28 +604,11 @@ isc__mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) {
|
|||||||
isc_mem_t *ctx = *ctxp;
|
isc_mem_t *ctx = *ctxp;
|
||||||
*ctxp = NULL;
|
*ctxp = NULL;
|
||||||
|
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging &
|
|
||||||
(ISC_MEM_DEBUGSIZE | ISC_MEM_DEBUGCTX)) != 0))
|
|
||||||
{
|
|
||||||
if ((isc_mem_debugging & ISC_MEM_DEBUGSIZE) != 0) {
|
|
||||||
size_info *si = &(((size_info *)ptr)[-1]);
|
|
||||||
size_t oldsize = si->size - ALIGNMENT_SIZE;
|
|
||||||
if ((isc_mem_debugging & ISC_MEM_DEBUGCTX) != 0) {
|
|
||||||
oldsize -= ALIGNMENT_SIZE;
|
|
||||||
}
|
|
||||||
INSIST(oldsize == size);
|
|
||||||
}
|
|
||||||
isc__mem_free(ctx, ptr FLARG_PASS);
|
|
||||||
|
|
||||||
goto destroy;
|
|
||||||
}
|
|
||||||
|
|
||||||
DELETE_TRACE(ctx, ptr, size, file, line);
|
DELETE_TRACE(ctx, ptr, size, file, line);
|
||||||
|
|
||||||
mem_putstats(ctx, ptr, size);
|
mem_putstats(ctx, ptr, size);
|
||||||
mem_put(ctx, ptr, size);
|
mem_put(ctx, ptr, size);
|
||||||
|
|
||||||
destroy:
|
|
||||||
if (isc_refcount_decrement(&ctx->references) == 1) {
|
if (isc_refcount_decrement(&ctx->references) == 1) {
|
||||||
isc_refcount_destroy(&ctx->references);
|
isc_refcount_destroy(&ctx->references);
|
||||||
destroy(ctx);
|
destroy(ctx);
|
||||||
@@ -717,12 +700,6 @@ isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
|
|||||||
void *ptr;
|
void *ptr;
|
||||||
bool call_water = false;
|
bool call_water = false;
|
||||||
|
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging &
|
|
||||||
(ISC_MEM_DEBUGSIZE | ISC_MEM_DEBUGCTX)) != 0))
|
|
||||||
{
|
|
||||||
return (isc__mem_allocate(ctx, size FLARG_PASS));
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr = mem_get(ctx, size);
|
ptr = mem_get(ctx, size);
|
||||||
mem_getstats(ctx, size);
|
mem_getstats(ctx, size);
|
||||||
|
|
||||||
@@ -743,23 +720,6 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG) {
|
|||||||
REQUIRE(ptr != NULL);
|
REQUIRE(ptr != NULL);
|
||||||
|
|
||||||
bool call_water = false;
|
bool call_water = false;
|
||||||
size_info *si;
|
|
||||||
|
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging &
|
|
||||||
(ISC_MEM_DEBUGSIZE | ISC_MEM_DEBUGCTX)) != 0))
|
|
||||||
{
|
|
||||||
if ((isc_mem_debugging & ISC_MEM_DEBUGSIZE) != 0) {
|
|
||||||
size_t oldsize;
|
|
||||||
si = &(((size_info *)ptr)[-1]);
|
|
||||||
oldsize = si->size - ALIGNMENT_SIZE;
|
|
||||||
if ((isc_mem_debugging & ISC_MEM_DEBUGCTX) != 0) {
|
|
||||||
oldsize -= ALIGNMENT_SIZE;
|
|
||||||
}
|
|
||||||
INSIST(oldsize == size);
|
|
||||||
}
|
|
||||||
isc__mem_free(ctx, ptr FLARG_PASS);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DELETE_TRACE(ctx, ptr, size, file, line);
|
DELETE_TRACE(ctx, ptr, size, file, line);
|
||||||
|
|
||||||
@@ -894,16 +854,9 @@ mem_allocateunlocked(isc_mem_t *ctx, size_t size) {
|
|||||||
size_info *si;
|
size_info *si;
|
||||||
|
|
||||||
size += ALIGNMENT_SIZE;
|
size += ALIGNMENT_SIZE;
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging & ISC_MEM_DEBUGCTX) != 0)) {
|
|
||||||
size += ALIGNMENT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
si = mem_get(ctx, size);
|
si = mem_get(ctx, size);
|
||||||
|
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging & ISC_MEM_DEBUGCTX) != 0)) {
|
|
||||||
si->ctx = ctx;
|
|
||||||
si++;
|
|
||||||
}
|
|
||||||
si->size = size;
|
si->size = size;
|
||||||
return (&si[1]);
|
return (&si[1]);
|
||||||
}
|
}
|
||||||
@@ -955,11 +908,6 @@ isc__mem_reallocate(isc_mem_t *ctx, void *ptr, size_t size FLARG) {
|
|||||||
oldsize = (((size_info *)ptr)[-1]).size;
|
oldsize = (((size_info *)ptr)[-1]).size;
|
||||||
INSIST(oldsize >= ALIGNMENT_SIZE);
|
INSIST(oldsize >= ALIGNMENT_SIZE);
|
||||||
oldsize -= ALIGNMENT_SIZE;
|
oldsize -= ALIGNMENT_SIZE;
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging &
|
|
||||||
ISC_MEM_DEBUGCTX) != 0)) {
|
|
||||||
INSIST(oldsize >= ALIGNMENT_SIZE);
|
|
||||||
oldsize -= ALIGNMENT_SIZE;
|
|
||||||
}
|
|
||||||
copysize = (oldsize > size) ? size : oldsize;
|
copysize = (oldsize > size) ? size : oldsize;
|
||||||
memmove(new_ptr, ptr, copysize);
|
memmove(new_ptr, ptr, copysize);
|
||||||
isc__mem_free(ctx, ptr FLARG_PASS);
|
isc__mem_free(ctx, ptr FLARG_PASS);
|
||||||
@@ -980,14 +928,8 @@ isc__mem_free(isc_mem_t *ctx, void *ptr FLARG) {
|
|||||||
size_t size;
|
size_t size;
|
||||||
bool call_water = false;
|
bool call_water = false;
|
||||||
|
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging & ISC_MEM_DEBUGCTX) != 0)) {
|
si = &(((size_info *)ptr)[-1]);
|
||||||
si = &(((size_info *)ptr)[-2]);
|
size = si->size;
|
||||||
REQUIRE(si->ctx == ctx);
|
|
||||||
size = si[1].size;
|
|
||||||
} else {
|
|
||||||
si = &(((size_info *)ptr)[-1]);
|
|
||||||
size = si->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
DELETE_TRACE(ctx, ptr, size, file, line);
|
DELETE_TRACE(ctx, ptr, size, file, line);
|
||||||
|
|
||||||
|
@@ -72,11 +72,7 @@ tls_initialize(void) {
|
|||||||
/*
|
/*
|
||||||
* We can't use isc_mem API here, because it's called too
|
* We can't use isc_mem API here, because it's called too
|
||||||
* early and when the isc_mem_debugging flags are changed
|
* early and when the isc_mem_debugging flags are changed
|
||||||
* later and ISC_MEM_DEBUGSIZE or ISC_MEM_DEBUGCTX flags are
|
* later.
|
||||||
* added, neither isc_mem_put() nor isc_mem_free() can be used
|
|
||||||
* to free up the memory allocated here because the flags were
|
|
||||||
* not set when calling isc_mem_get() or isc_mem_allocate()
|
|
||||||
* here.
|
|
||||||
*
|
*
|
||||||
* Actually, since this is a single allocation at library load
|
* Actually, since this is a single allocation at library load
|
||||||
* and deallocation at library unload, using the standard
|
* and deallocation at library unload, using the standard
|
||||||
|
@@ -40,17 +40,13 @@ static size_t isc__trampoline_min = 1;
|
|||||||
static size_t isc__trampoline_max = 65;
|
static size_t isc__trampoline_max = 65;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't use isc_mem API here, because it's called too
|
* We can't use isc_mem API here, because it's called too early and the
|
||||||
* early and when the isc_mem_debugging flags are changed
|
* isc_mem_debugging flags can be changed later causing mismatch between flags
|
||||||
* later and ISC_MEM_DEBUGSIZE or ISC_MEM_DEBUGCTX flags are
|
* used for isc_mem_get() and isc_mem_put().
|
||||||
* added, neither isc_mem_put() nor isc_mem_free() can be used
|
|
||||||
* to free up the memory allocated here because the flags were
|
|
||||||
* not set when calling isc_mem_get() or isc_mem_allocate()
|
|
||||||
* here.
|
|
||||||
*
|
*
|
||||||
* Actually, since this is a single allocation at library load
|
* Since this is a single allocation at library load and deallocation at library
|
||||||
* and deallocation at library unload, using the standard
|
* unload, using the standard allocator without the tracking is fine for this
|
||||||
* allocator without the tracking is fine for this purpose.
|
* single purpose.
|
||||||
*/
|
*/
|
||||||
static isc__trampoline_t *
|
static isc__trampoline_t *
|
||||||
isc__trampoline_new(int tid, isc_threadfunc_t start, isc_threadarg_t arg) {
|
isc__trampoline_new(int tid, isc_threadfunc_t start, isc_threadarg_t arg) {
|
||||||
|
Reference in New Issue
Block a user