Lines Matching refs:malloc
2 This is a version (aka dlmalloc) of malloc/free/realloc written by
9 Note: There may be an updated version of this malloc obtainable at
10 ftp://gee.cs.oswego.edu/pub/misc/malloc.c
21 For convenience, an include file for code using this malloc is at:
22 ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.4.h
25 excerpts from this file needed for using this malloc on ANSI C/C++
28 own malloc.h that does include all settings by cutting at the point
30 library containing a malloc that is based on some version of this
31 malloc (for example in linux). You might still want to use the one
41 than pointers, you can use a previous release of this malloc
58 Even a request for zero bytes (i.e., malloc(0)) returns a
61 allocated than were requested in malloc) is less than or equal
68 The "security" of malloc refers to the ability of malicious
70 space that is not currently malloc'ed or overwriting past the
71 ends of chunks) in code that calls malloc. This malloc
76 for malloc itself is not corrupted by some other means. This
83 execution of a program using malloc, but differ across
94 has no effect, and a malloc that encounters a bad address
103 else. And if if you are sure that your program using malloc has
108 When USE_LOCKS is defined, each public call to malloc, free,
113 basis for extensions. If you are using malloc in a concurrent
116 ptmalloc (See http://www.malloc.de), which are derived
117 from versions of this malloc.
120 This malloc can use unix sbrk or any emulation (invoked using
135 most tunable malloc ever written. However it is among the fastest
138 general-purpose allocator for malloc-intensive programs.
140 In most ways, this malloc is a best-fit allocator. Generally, it
175 http://gee.cs.oswego.edu/dl/html/malloc.html
178 If MSPACES is defined, then in addition to malloc, free, etc.,
180 are versions of malloc routines that take an "mspace" argument
184 and your system malloc for others, you can compile with
190 use "USE_DL_PREFIX" to relabel the global malloc.)
218 cases where this malloc might not be a pure drop-in replacement for
219 Win32 malloc: Random-looking failures from Win32 GDI API's (eg;
221 when pixel buffers are malloc()ed, and the region spans more than
226 buffers rather than using malloc(). If this is not possible,
227 recompile this malloc with a larger DEFAULT_GRANULARITY.
230 Controls the minimum alignment for malloc'ed chunks. It must be a
266 This can be useful when you only want to use this malloc in one part
267 of a program, using your regular system malloc elsewhere.
272 message, because the underlying print routines in turn call malloc,
276 addresses etc) rather than malloc-triggered checks, so will also
285 ability to ever return it from malloc again, but enabling the
304 version of the assert macro causes malloc to be called, which will
310 The action to take before "return 0" when malloc fails to be able to
331 set it true anyway, since malloc copes with non-contiguities.
366 Causes malloc to use the builtin ffs() function to compute indices.
374 The system page size. To the extent possible, this malloc manages
381 Causes malloc to use /dev/random to initialize secure magic seed for
397 since this malloc returns a unique pointer for malloc(0), so does
418 versions of malloc, the equivalent of this option was called
666 numbers for mallopt, normally defined in malloc.h. None of these
667 are used in this malloc, so setting them has no effect. But this
668 malloc does support the following options.
679 This version of malloc supports the standard SVID/XPG mallinfo
682 /usr/include/malloc.h defining struct mallinfo. The main
685 are not even meaningful in this version of malloc. These fields are
690 /usr/include/malloc.h file that includes a declaration of struct
703 #include "/usr/include/malloc.h"
762 #define dlmalloc malloc
780 malloc(size_t n)
785 If n is zero, malloc returns a minimum-sized chunk. (The minimum
798 allocated using malloc or a related routine such as realloc.
819 employs the equivalent of a malloc-copy-free sequence.
821 If p is null, realloc is equivalent to malloc.
843 8-byte alignment is guaranteed by normal malloc calls, so don't
868 normally defined in malloc.h. None of these are use in this malloc,
869 so setting them has no effect. But this malloc also supports other
884 number of bytes allocated by malloc, realloc etc., is less than this
897 by malloc, realloc etc., is less than this value. Unlike mallinfo,
1009 should instead use a single regular malloc, and assign pointers at
1038 detect enough difference from series of malloc calls to bother.
1058 to sbrk) if there is unused memory at the `high' end of the malloc
1082 number of bytes allocated via malloc (or realloc, etc) but not yet
1091 (normally sbrk) outside of malloc.
1111 p = malloc(n);
1172 mspace_malloc behaves as malloc, but operates within
1275 To make a fully customizable malloc.h header file, cut everything
1276 above this line, put into file malloc.h, edit to suit, and #include it
1277 on the next line, as well as in programs that use this malloc.
1281 /* #include "malloc.h" */
1631 Per-mspace locks surround calls to malloc, free, etc. To enable use
1643 TRY_LOCK (which is not used in this malloc, but commonly needed in
2087 /* The smallest size we can malloc is an aligned minimal chunk */
2091 /* conversion from malloc headers to user pointers, and back */
2117 FLAG4_BIT is not used by this malloc, but might be useful in extensions.
2286 Each malloc space may include non-contiguous segments, held in a
2401 intended to reduce the branchiness of paths through malloc etc, as
2434 extensions to this malloc.
2544 /* For sys_alloc, enough padding to ensure can malloc request on success */
2842 For security, the main invariant is that malloc/free/etc never
2845 malloc (because of these checks). In essence this means that we
2853 that the mstate controlling malloc/free is intact. This is a
2860 computed by any code successfully malloc'ing any chunk, so does not
3006 /* Set up lock for main malloc area */
3639 /* Relays to internal calls to malloc/free from realloc, memalign etc */
3666 /* Malloc using mmap */
3902 we can malloc nb bytes upon success, so pad with enough space for
4186 /* ---------------------------- malloc support --------------------------- */
4237 /* If dv is a better fit, return 0 so malloc will use it */
4311 /* Try to either shrink or extend into top. Else malloc-copy-free */
4375 if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */
4519 malloc won't use it, since we would not be able to later
5423 but this will usually result in a malloc failure.)
5431 addresses, it must be OK for malloc'ed chunks to span multiple
5569 * Bypass most of malloc if no frees. Thanks To Emery Berger.
5591 * Collect all cases in malloc requiring system memory into sysmalloc
5624 * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
5673 * malloc: swap order of clean-bin strategy;
5682 * merged all consolidations to one part of malloc proper
5685 * Propagate failure in realloc if malloc returns 0
5699 * Based loosely on libg++-1.2X malloc. (It retains some of the overall