From 6af660ee01c05048b7704273e88e9249deb8202f Mon Sep 17 00:00:00 2001 From: Ilya Zakharevich Date: Tue, 15 Jul 2003 00:46:58 -0700 Subject: malloc cleanup Message-ID: <20030715144657.GA21313@math.berkeley.edu> p4raw-id: //depot/perl@20184 --- makedef.pl | 4 ++++ malloc.c | 14 +++++++++++--- malloc_ctl.h | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/makedef.pl b/makedef.pl index 9363f8b6e0..5597057da0 100644 --- a/makedef.pl +++ b/makedef.pl @@ -602,6 +602,8 @@ if ($define{'MYMALLOC'}) { Perl_get_mstats Perl_strdup Perl_putenv + MallocCfg_ptr + MallocCfgP_ptr )]; if ($define{'USE_ITHREADS'}) { emit_symbols [qw( @@ -620,6 +622,8 @@ else { Perl_dump_mstats Perl_get_mstats Perl_malloced_size + MallocCfg_ptr + MallocCfgP_ptr )]; } diff --git a/malloc.c b/malloc.c index 0656064177..6013e40083 100644 --- a/malloc.c +++ b/malloc.c @@ -1068,6 +1068,12 @@ static IV MallocCfg[MallocCfg_last] = { }; IV *MallocCfg_ptr = MallocCfg; +static char* MallocCfgP[MallocCfg_last] = { + 0, /* MallocCfgP_emergency_buffer */ + 0, /* MallocCfgP_emergency_buffer_prepared */ +}; +char **MallocCfgP_ptr = MallocCfgP; + # undef MIN_SBRK # undef FIRST_SBRK # undef MIN_SBRK_FRAC1000 @@ -1090,6 +1096,9 @@ IV *MallocCfg_ptr = MallocCfg; # define FILL_CHECK_CFG MallocCfg[MallocCfg_fillcheck] # define FILL_CHECK (FILL_DEAD && FILL_CHECK_CFG) +# define emergency_buffer MallocCfgP[MallocCfgP_emergency_buffer] +# define emergency_buffer_prepared MallocCfgP[MallocCfgP_emergency_buffer_prepared] + #else /* defined(NO_MALLOC_DYNAMIC_CFG) */ # define FILL_DEAD 1 @@ -1121,14 +1130,13 @@ static u_int goodsbrk; # define BIG_SIZE (1<<16) /* 64K */ # endif -static char *emergency_buffer; -static char *emergency_buffer_prepared; - # ifdef NO_MALLOC_DYNAMIC_CFG static MEM_SIZE emergency_buffer_size; /* 0 if the last request for more memory succeeded. Otherwise the size of the failing request. */ static MEM_SIZE emergency_buffer_last_req; +static char *emergency_buffer; +static char *emergency_buffer_prepared; # endif # ifndef emergency_sbrk_croak diff --git a/malloc_ctl.h b/malloc_ctl.h index 2bce0c113c..7a6aed0db7 100644 --- a/malloc_ctl.h +++ b/malloc_ctl.h @@ -25,6 +25,7 @@ END_EXTERN_C #ifndef NO_MALLOC_DYNAMIC_CFG +/* IV configuration data */ enum { MallocCfg_FIRST_SBRK, MallocCfg_MIN_SBRK, @@ -47,8 +48,15 @@ enum { MallocCfg_last }; +/* char* configuration data */ +enum { + MallocCfgP_emergency_buffer, + MallocCfgP_emergency_buffer_prepared, + MallocCfgP_last +}; START_EXTERN_C extern IV *MallocCfg_ptr; +extern char **MallocCfgP_ptr; END_EXTERN_C #endif -- cgit v1.2.1