diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-20 07:31:11 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-20 07:31:11 +0000 |
commit | 22f7c9c9717fe07b508ba0e9958ef0592cdbbeef (patch) | |
tree | 242e338c2ed54d78f98bb01642efd8eda56268fa /malloc_ctl.h | |
parent | dda12f46c06c4294f4f764c1854204b0608b68e4 (diff) | |
download | perl-22f7c9c9717fe07b508ba0e9958ef0592cdbbeef.tar.gz |
More Perl malloc debugging magic from Ilya. Seems to work in
Linux, Solaris, AIX. Had to do #ifdef OS2 for the <io.h> in
malloc.c, found in AIX since there is no such header.
In Tru64 miniperl fails an assert: "free()ed/realloc()ed-away
memory was overwritten?"
(In IRIX compiles but that doesn't prove much since in IRIX
Perl's malloc is simply not used.)
p4raw-id: //depot/perl@19831
Diffstat (limited to 'malloc_ctl.h')
-rw-r--r-- | malloc_ctl.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/malloc_ctl.h b/malloc_ctl.h new file mode 100644 index 0000000000..e0bee00ea3 --- /dev/null +++ b/malloc_ctl.h @@ -0,0 +1,54 @@ +#ifndef MALLOC_CTL_H +# define MALLOC_CTL_H + +struct perl_mstats { + UV *nfree; + UV *ntotal; + IV topbucket, topbucket_ev, topbucket_odd, totfree, total, total_chain; + IV total_sbrk, sbrks, sbrk_good, sbrk_slack, start_slack, sbrked_remains; + IV minbucket; + /* Level 1 info */ + UV *bucket_mem_size; + UV *bucket_available_size; + UV nbuckets; +}; +typedef struct perl_mstats perl_mstats_t; + +START_EXTERN_C +Malloc_t Perl_malloc (MEM_SIZE nbytes); +Malloc_t Perl_calloc (MEM_SIZE elements, MEM_SIZE size); +Malloc_t Perl_realloc (Malloc_t where, MEM_SIZE nbytes); +/* 'mfree' rather than 'free', since there is already a 'perl_free' + * that causes clashes with case-insensitive linkers */ +Free_t Perl_mfree (Malloc_t where); +END_EXTERN_C + +#ifndef NO_MALLOC_DYNAMIC_CFG + +enum { + MallocCfg_FIRST_SBRK, + MallocCfg_MIN_SBRK, + MallocCfg_MIN_SBRK_FRAC1000, + MallocCfg_SBRK_ALLOW_FAILURES, + MallocCfg_SBRK_FAILURE_PRICE, + MallocCfg_sbrk_goodness, + + MallocCfg_filldead, + MallocCfg_fillalive, + MallocCfg_fillcheck, + + MallocCfg_skip_cfg_env, + MallocCfg_cfg_env_read, + + MallocCfg_emergency_buffer_size, + MallocCfg_emergency_buffer_last_req, + + MallocCfg_emergency_buffer_prepared_size, + + MallocCfg_last +}; +extern IV *MallocCfg_ptr; + +#endif + +#endif |