diff options
author | Egor Duda <deo@logos-m.ru> | 2001-04-24 15:25:31 +0000 |
---|---|---|
committer | Egor Duda <deo@logos-m.ru> | 2001-04-24 15:25:31 +0000 |
commit | 8db71e01698f00c71eed124b1609f019776900a1 (patch) | |
tree | 3614b12bd953007317cacf6e89eecccc24497c4a /winsup/cygwin/dlmalloc.h | |
parent | 19a90cfeaf3f3ed0de79f061a76cd5cabfd0f021 (diff) | |
download | cygnal-8db71e01698f00c71eed124b1609f019776900a1.tar.gz cygnal-8db71e01698f00c71eed124b1609f019776900a1.tar.bz2 cygnal-8db71e01698f00c71eed124b1609f019776900a1.zip |
* dlmalloc.c: New file. Port of Doug Lea's malloc
* dlmalloc.h: Ditto.
* Makefile.in: Add support for MALLOC_DEBUG
* config.h.in: Ditto.
* winsup.h: Ditto.
* configure.in: Add --enable-malloc-debugging option.
* configure: Regenerate.
* debug.h: Include declarations for debugging malloc.
* tty.cc (grantpt): Fix definition.
(unlockpt): Ditto.
Diffstat (limited to 'winsup/cygwin/dlmalloc.h')
-rw-r--r-- | winsup/cygwin/dlmalloc.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/winsup/cygwin/dlmalloc.h b/winsup/cygwin/dlmalloc.h new file mode 100644 index 000000000..15b25db7b --- /dev/null +++ b/winsup/cygwin/dlmalloc.h @@ -0,0 +1,96 @@ + +/* + * Header file for BBCized version of Doug Lea's malloc.c, automatically + * generated by + * /source/prod/libbbc/compat/dlmalloc/cvt + * from + * /source/prod/libbbc/compat/dlmalloc/malloc.c + * + * bbclabel: autogenerated + */ + +void malloc_outofmem(void (*)(void)); + + +struct mallinfo { + int arena; /* total space allocated from system */ + int ordblks; /* number of non-inuse chunks */ + int smblks; /* unused -- always zero */ + int hblks; /* number of mmapped regions */ + int hblkhd; /* total space in mmapped regions */ + int usmblks; /* unused -- always zero */ + int fsmblks; /* unused -- always zero */ + int uordblks; /* total allocated space */ + int fordblks; /* total non-inuse space */ + int keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + + +#define M_MXFAST 1 /* UNUSED in this malloc */ +#define M_NLBLKS 2 /* UNUSED in this malloc */ +#define M_GRAIN 3 /* UNUSED in this malloc */ +#define M_KEEP 4 /* UNUSED in this malloc */ + + +#define M_TRIM_THRESHOLD -1 +#define M_TOP_PAD -2 +#define M_MMAP_THRESHOLD -3 +#define M_MMAP_MAX -4 +#define M_SCANHEAP -5 +#define M_FILL + +#ifdef MALLOC_DEBUG + +#define malloc(size) malloc_dbg(size, __FILE__, __LINE__) +#define free(p) free_dbg(p, __FILE__, __LINE__) +#define realloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__) +#define calloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__) +#define memalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__) +#define valloc(size) valloc_dbg(size, __FILE__, __LINE__) +#define pvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__) +#define cfree(p) cfree_dbg(p, __FILE__, __LINE__) +#define malloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__) +#define malloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__) +#define malloc_stats() malloc_stats_dbg(__FILE__, __LINE__) +#define mallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__) +#define mallinfo() mallinfo_dbg(__FILE__, __LINE__) + + +#ifdef __cplusplus +extern "C" { +#endif +void* malloc_dbg(size_t, const char *, int); +void free_dbg(void*, const char *, int); +void* realloc_dbg(void*, size_t, const char *, int); +void* calloc_dbg(size_t, size_t, const char *, int); +void* memalign_dbg(size_t, size_t, const char *, int); +void* valloc_dbg(size_t, const char *, int); +void* pvalloc_dbg(size_t, const char *, int); +void cfree_dbg(void*, const char *, int); +int malloc_trim_dbg(size_t, const char *, int); +size_t malloc_usable_size_dbg(void*, const char *, int); +void malloc_stats_dbg(const char *, int); +int mallopt_dbg(int, int, const char *, int); +struct mallinfo mallinfo_dbg(const char *, int); +#ifdef __cplusplus +} +#endif + +#endif /* MALLOC_DEBUG */ + +#ifndef MALLOC_DEBUG + +void* malloc(size_t); +void free(void*); +void* realloc(void*, size_t); +void* calloc(size_t, size_t); +void* memalign(size_t, size_t); +void* valloc(size_t); +void* pvalloc(size_t); +void cfree(void*); +int malloc_trim(size_t); +size_t malloc_usable_size(void*); +void malloc_stats(void); +int mallopt(int, int); +struct mallinfo mallinfo(void); +#endif /* !MALLOC_DEBUG */ |