From: Wouter Wijngaards Date: Thu, 11 Mar 2010 09:35:08 +0000 (+0000) Subject: --enable-alloc-nonregional X-Git-Tag: release-1.4.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62298b8bfcd9ef2df91ed86557841e5db89341c6;p=thirdparty%2Funbound.git --enable-alloc-nonregional git-svn-id: file:///svn/unbound/trunk@2022 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index 99f8cbc6d..c522663ee 100644 --- a/config.h.in +++ b/config.h.in @@ -423,6 +423,9 @@ /* use to enable lightweight alloc assertions, for debug use */ #undef UNBOUND_ALLOC_LITE +/* use malloc not regions, for debug use */ +#undef UNBOUND_ALLOC_NONREGIONAL + /* use statistics for allocs and frees, for debug use */ #undef UNBOUND_ALLOC_STATS diff --git a/configure b/configure index 81e21a87e..a9f411fd6 100755 --- a/configure +++ b/configure @@ -933,6 +933,7 @@ enable_staticexe enable_lock_checks enable_alloc_checks enable_alloc_lite +enable_alloc_nonregional enable_largefile with_ldns with_ldns_builtin @@ -1592,6 +1593,10 @@ Optional Features: purposes --enable-alloc-lite enable for lightweight alloc assertions, for debug purposes + --enable-alloc-nonregional + enable nonregional allocs, slow but exposes regional + allocations to other memory purifiers, for debug + purposes --disable-largefile omit support for large files Optional Packages: @@ -7293,13 +7298,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:7296: $ac_compile\"" >&5) + (eval echo "\"\$as_me:7301: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:7299: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:7304: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:7302: output\"" >&5) + (eval echo "\"\$as_me:7307: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -8504,7 +8509,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 8507 "configure"' > conftest.$ac_ext + echo '#line 8512 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9871,11 +9876,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9874: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9879: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9878: \$? = $ac_status" >&5 + echo "$as_me:9883: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -10210,11 +10215,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10213: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10218: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10217: \$? = $ac_status" >&5 + echo "$as_me:10222: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -10315,11 +10320,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10318: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10323: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10322: \$? = $ac_status" >&5 + echo "$as_me:10327: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10370,11 +10375,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10373: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10378: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10377: \$? = $ac_status" >&5 + echo "$as_me:10382: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13173,7 +13178,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 13176 "configure" +#line 13181 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13269,7 +13274,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 13272 "configure" +#line 13277 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19273,6 +19278,18 @@ if test "${enable_alloc_lite+set}" = set; then enableval=$enable_alloc_lite; fi +# Check whether --enable-alloc-nonregional was given. +if test "${enable_alloc_nonregional+set}" = set; then + enableval=$enable_alloc_nonregional; +fi + +if test x_$enable_alloc_nonregional = x_yes; then + +cat >>confdefs.h <<\_ACEOF +#define UNBOUND_ALLOC_NONREGIONAL 1 +_ACEOF + +fi if test x_$enable_alloc_checks = x_yes; then cat >>confdefs.h <<\_ACEOF diff --git a/configure.ac b/configure.ac index 9ade3efb6..f40bb11ff 100644 --- a/configure.ac +++ b/configure.ac @@ -521,6 +521,12 @@ AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks], AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite], [ enable for lightweight alloc assertions, for debug purposes ]), , ) +AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional], + [ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]), + , ) +if test x_$enable_alloc_nonregional = x_yes; then + AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use]) +fi if test x_$enable_alloc_checks = x_yes; then AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use]) else diff --git a/doc/Changelog b/doc/Changelog index fe1eb95d9..8977b2cb4 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +11 March 2010: Wouter + - another memory allocation option: --enable-alloc-nonregional. + exposes the regional allocations to other memory purifiers. + 10 March 2010: Wouter - --enable-alloc-lite works with test set. - portability in the testset: printf format conversions, prototypes. diff --git a/util/regional.c b/util/regional.c index b314c2937..37f243909 100644 --- a/util/regional.c +++ b/util/regional.c @@ -54,8 +54,13 @@ /** Default reasonable size for chunks */ #define REGIONAL_CHUNK_SIZE 8192 +#ifdef UNBOUND_ALLOC_NONREGIONAL +/** All objects allocated outside of chunks, for debug */ +#define REGIONAL_LARGE_OBJECT_SIZE 0 +#else /** Default size for large objects - allocated outside of chunks. */ #define REGIONAL_LARGE_OBJECT_SIZE 2048 +#endif struct regional* regional_create()