summaryrefslogtreecommitdiff
path: root/malloc/malloc.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-29 07:54:51 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-29 07:54:51 +0000
commitfa8d436c87f156d18208df3819fecee9fc1dbd9e (patch)
treee22f5754d69c0144f0945a26727c3984008f9d37 /malloc/malloc.h
parentdb2ebcef2428cb568315895f8fe3ef19d41735bc (diff)
downloadglibc-fa8d436c87f156d18208df3819fecee9fc1dbd9e.tar.gz
Update.
2002-01-18 Wolfram Gloger <wg@malloc.de> * malloc/malloc.c: Rewrite, adapted from Doug Lea's malloc-2.7.0.c. * malloc/malloc.h: Likewise. * malloc/arena.c: New file. * malloc/hooks.c: New file. * malloc/tst-mallocstate.c: New file. * malloc/Makefile: Add new testcase tst-mallocstate. Add arena.c and hooks.c to distribute. Fix commented CPPFLAGS. 2002-01-28 Ulrich Drepper <drepper@redhat.com> * stdlib/msort.c: Remove last patch. The optimization violates the same rule which qsort.c had problems with. 2002-01-27 Paul Eggert <eggert@twinsun.com> * stdlib/qsort.c (_quicksort): Do not apply the comparison function to a pivot element that lies outside the array to be sorted, as ISO C99 requires that the comparison function be called only with addresses of array elements [PR libc/2880].
Diffstat (limited to 'malloc/malloc.h')
-rw-r--r--malloc/malloc.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/malloc/malloc.h b/malloc/malloc.h
index 8accd64699..aaa95b3a2c 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -20,24 +20,26 @@
#ifndef _MALLOC_H
#define _MALLOC_H 1
+#ifdef _LIBC
#include <features.h>
+#endif
/*
- `ptmalloc', a malloc implementation for multiple threads without
- lock contention, by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>.
- See the files `ptmalloc.c' or `COPYRIGHT' for copying conditions.
+ $Id$
+ `ptmalloc2', a malloc implementation for multiple threads without
+ lock contention, by Wolfram Gloger <wg@malloc.de>.
- VERSION 2.6.4-pt Wed Dec 4 00:35:54 MET 1996
+ VERSION 2.7.0
- This work is mainly derived from malloc-2.6.4 by Doug Lea
+ This work is mainly derived from malloc-2.7.0 by Doug Lea
<dl@cs.oswego.edu>, which is available from:
- ftp://g.oswego.edu/pub/misc/malloc.c
+ ftp://gee.cs.oswego.edu/pub/misc/malloc.c
This trimmed-down header file only provides function prototypes and
the exported data structures. For more detailed function
descriptions and compile-time options, see the source file
- `ptmalloc.c'.
+ `malloc.c'.
*/
#if defined(__STDC__) || defined (__cplusplus)
@@ -112,11 +114,6 @@ extern "C" {
#endif
extern int __malloc_initialized;
-/* Initialize global configuration. Not needed with GNU libc. */
-#ifndef __GLIBC__
-extern void ptmalloc_init __MALLOC_P ((void));
-#endif
-
/* Allocate SIZE bytes of memory. */
extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
@@ -156,16 +153,17 @@ extern __malloc_ptr_t __default_morecore __MALLOC_P ((ptrdiff_t __size))
__attribute_malloc__;
/* SVID2/XPG mallinfo structure */
+
struct mallinfo {
- int arena; /* total space allocated from system */
- int ordblks; /* number of non-inuse chunks */
- int smblks; /* unused -- always zero */
+ int arena; /* non-mmapped space allocated from system */
+ int ordblks; /* number of free chunks */
+ int smblks; /* number of fastbin blocks */
int hblks; /* number of mmapped regions */
- int hblkhd; /* total space in mmapped regions */
- int usmblks; /* unused -- always zero */
- int fsmblks; /* unused -- always zero */
+ int hblkhd; /* space in mmapped regions */
+ int usmblks; /* maximum total allocated space */
+ int fsmblks; /* space available in freed fastbin blocks */
int uordblks; /* total allocated space */
- int fordblks; /* total non-inuse space */
+ int fordblks; /* total free space */
int keepcost; /* top-most, releasable (via malloc_trim) space */
};
@@ -174,7 +172,7 @@ extern struct mallinfo mallinfo __MALLOC_P ((void));
/* SVID2/XPG mallopt options */
#ifndef M_MXFAST
-# define M_MXFAST 1 /* UNUSED in this malloc */
+# define M_MXFAST 1 /* maximum request size for "fastbins" */
#endif
#ifndef M_NLBLKS
# define M_NLBLKS 2 /* UNUSED in this malloc */
@@ -214,7 +212,6 @@ extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
malloc_get_state(). */
extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
-#if defined __GLIBC__ || defined MALLOC_HOOKS
/* Called once when malloc is initialized; redefining this variable in
the application provides the preferred way to set up the hook
pointers. */
@@ -234,7 +231,19 @@ extern void (*__after_morecore_hook) __MALLOC_PMT ((void));
/* Activate a standard set of debugging hooks. */
extern void __malloc_check_init __MALLOC_P ((void));
-#endif
+
+/* Internal routines, operating on "arenas". */
+struct malloc_state;
+typedef struct malloc_state *mstate;
+
+extern mstate _int_new_arena __MALLOC_P ((size_t __ini_size));
+extern __malloc_ptr_t _int_malloc __MALLOC_P ((mstate __m, size_t __size));
+extern void _int_free __MALLOC_P ((mstate __m, __malloc_ptr_t __ptr));
+extern __malloc_ptr_t _int_realloc __MALLOC_P ((mstate __m,
+ __malloc_ptr_t __ptr,
+ size_t __size));
+extern __malloc_ptr_t _int_memalign __MALLOC_P ((mstate __m, size_t __alignment,
+ size_t __size));
#ifdef __cplusplus
}; /* end of extern "C" */