malloc.c.h File Reference

#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/param.h>

Include dependency graph for malloc.c.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mallinfo
struct  malloc_chunk
struct  malloc_tree_chunk
struct  malloc_segment
struct  malloc_state
struct  malloc_params

Defines

#define DLMALLOC_VERSION   20804
#define MAX_SIZE_T   (~(size_t)0)
#define ONLY_MSPACES   0
#define MSPACES   0
#define MALLOC_ALIGNMENT   ((size_t)8U)
#define FOOTERS   0
#define ABORT   abort()
#define ABORT_ON_ASSERT_FAILURE   1
#define PROCEED_ON_ERROR   0
#define USE_LOCKS   0
#define USE_SPIN_LOCKS   0
#define INSECURE   0
#define HAVE_MMAP   1
#define MMAP_CLEARS   1
#define HAVE_MREMAP   0
#define MALLOC_FAILURE_ACTION   errno = ENOMEM;
#define HAVE_MORECORE   1
#define MORECORE_DEFAULT   sbrk
#define MORECORE_CONTIGUOUS   1
#define DEFAULT_GRANULARITY   (0)
#define DEFAULT_TRIM_THRESHOLD   ((size_t)2U * (size_t)1024U * (size_t)1024U)
#define DEFAULT_MMAP_THRESHOLD   ((size_t)256U * (size_t)1024U)
#define MAX_RELEASE_CHECK_RATE   4095
#define USE_BUILTIN_FFS   0
#define USE_DEV_RANDOM   0
#define NO_MALLINFO   0
#define MALLINFO_FIELD_TYPE   size_t
#define NO_SEGMENT_TRAVERSAL   0
#define M_TRIM_THRESHOLD   (-1)
#define M_GRANULARITY   (-2)
#define M_MMAP_THRESHOLD   (-3)
#define STRUCT_MALLINFO_DECLARED   1
#define NOINLINE
#define dlcalloc   calloc
#define dlfree   free
#define dlmalloc   malloc
#define dlmemalign   memalign
#define dlrealloc   realloc
#define dlvalloc   valloc
#define dlpvalloc   pvalloc
#define dlmallinfo   mallinfo
#define dlmallopt   mallopt
#define dlmalloc_trim   malloc_trim
#define dlmalloc_stats   malloc_stats
#define dlmalloc_usable_size   malloc_usable_size
#define dlmalloc_footprint   malloc_footprint
#define dlmalloc_max_footprint   malloc_max_footprint
#define dlindependent_calloc   independent_calloc
#define dlindependent_comalloc   independent_comalloc
#define assert(x)
#define DEBUG   0
#define malloc_getpagesize   ((size_t)4096U)
#define SIZE_T_SIZE   (sizeof(size_t))
#define SIZE_T_BITSIZE   (sizeof(size_t) << 3)
#define SIZE_T_ZERO   ((size_t)0)
#define SIZE_T_ONE   ((size_t)1)
#define SIZE_T_TWO   ((size_t)2)
#define SIZE_T_FOUR   ((size_t)4)
#define TWO_SIZE_T_SIZES   (SIZE_T_SIZE<<1)
#define FOUR_SIZE_T_SIZES   (SIZE_T_SIZE<<2)
#define SIX_SIZE_T_SIZES   (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
#define HALF_MAX_SIZE_T   (MAX_SIZE_T / 2U)
#define CHUNK_ALIGN_MASK   (MALLOC_ALIGNMENT - SIZE_T_ONE)
#define is_aligned(A)   (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
#define align_offset(A)
#define MFAIL   ((void*)(MAX_SIZE_T))
#define CMFAIL   ((char*)(MFAIL))
#define MUNMAP_DEFAULT(a, s)   munmap((a), (s))
#define MMAP_PROT   (PROT_READ|PROT_WRITE)
#define MMAP_FLAGS   (MAP_PRIVATE)
#define MMAP_DEFAULT(s)
#define DIRECT_MMAP_DEFAULT(s)   MMAP_DEFAULT(s)
#define CALL_MORECORE(S)   MORECORE_DEFAULT(S)
#define IS_MMAPPED_BIT   (SIZE_T_ONE)
#define USE_MMAP_BIT   (SIZE_T_ONE)
#define CALL_MMAP(s)   MMAP_DEFAULT(s)
#define CALL_MUNMAP(a, s)   MUNMAP_DEFAULT((a), (s))
#define CALL_DIRECT_MMAP(s)   DIRECT_MMAP_DEFAULT(s)
#define CALL_MREMAP(addr, osz, nsz, mv)   MFAIL
#define USE_NONCONTIGUOUS_BIT   (4U)
#define EXTERN_BIT   (8U)
#define USE_LOCK_BIT   (0U)
#define INITIAL_LOCK(l)
#define ACQUIRE_MALLOC_GLOBAL_LOCK()
#define RELEASE_MALLOC_GLOBAL_LOCK()
#define MCHUNK_SIZE   (sizeof(mchunk))
#define CHUNK_OVERHEAD   (SIZE_T_SIZE)
#define MMAP_CHUNK_OVERHEAD   (TWO_SIZE_T_SIZES)
#define MMAP_FOOT_PAD   (FOUR_SIZE_T_SIZES)
#define MIN_CHUNK_SIZE   ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
#define chunk2mem(p)   ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
#define mem2chunk(mem)   ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
#define align_as_chunk(A)   (mchunkptr)((A) + align_offset(chunk2mem(A)))
#define MAX_REQUEST   ((-MIN_CHUNK_SIZE) << 2)
#define MIN_REQUEST   (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
#define pad_request(req)   (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
#define request2size(req)   (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
#define PINUSE_BIT   (SIZE_T_ONE)
#define CINUSE_BIT   (SIZE_T_TWO)
#define FLAG4_BIT   (SIZE_T_FOUR)
#define INUSE_BITS   (PINUSE_BIT|CINUSE_BIT)
#define FLAG_BITS   (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)
#define FENCEPOST_HEAD   (INUSE_BITS|SIZE_T_SIZE)
#define cinuse(p)   ((p)->head & CINUSE_BIT)
#define pinuse(p)   ((p)->head & PINUSE_BIT)
#define chunksize(p)   ((p)->head & ~(FLAG_BITS))
#define clear_pinuse(p)   ((p)->head &= ~PINUSE_BIT)
#define clear_cinuse(p)   ((p)->head &= ~CINUSE_BIT)
#define chunk_plus_offset(p, s)   ((mchunkptr)(((char*)(p)) + (s)))
#define chunk_minus_offset(p, s)   ((mchunkptr)(((char*)(p)) - (s)))
#define next_chunk(p)   ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))
#define prev_chunk(p)   ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))
#define next_pinuse(p)   ((next_chunk(p)->head) & PINUSE_BIT)
#define get_foot(p, s)   (((mchunkptr)((char*)(p) + (s)))->prev_foot)
#define set_foot(p, s)   (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))
#define set_size_and_pinuse_of_free_chunk(p, s)   ((p)->head = (s|PINUSE_BIT), set_foot(p, s))
#define set_free_with_pinuse(p, s, n)   (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
#define is_mmapped(p)   (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT))
#define overhead_for(p)   (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
#define calloc_must_clear(p)   (!is_mmapped(p))
#define leftmost_child(t)   ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
#define is_mmapped_segment(S)   ((S)->sflags & IS_MMAPPED_BIT)
#define is_extern_segment(S)   ((S)->sflags & EXTERN_BIT)
#define NSMALLBINS   (32U)
#define NTREEBINS   (32U)
#define SMALLBIN_SHIFT   (3U)
#define SMALLBIN_WIDTH   (SIZE_T_ONE << SMALLBIN_SHIFT)
#define TREEBIN_SHIFT   (8U)
#define MIN_LARGE_SIZE   (SIZE_T_ONE << TREEBIN_SHIFT)
#define MAX_SMALL_SIZE   (MIN_LARGE_SIZE - SIZE_T_ONE)
#define MAX_SMALL_REQUEST   (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
#define ensure_initialization()   (mparams.magic != 0 || init_mparams())
#define gm   (&_gm_)
#define is_global(M)   ((M) == &_gm_)
#define is_initialized(M)   ((M)->top != 0)
#define use_lock(M)   ((M)->mflags & USE_LOCK_BIT)
#define enable_lock(M)   ((M)->mflags |= USE_LOCK_BIT)
#define disable_lock(M)   ((M)->mflags &= ~USE_LOCK_BIT)
#define use_mmap(M)   ((M)->mflags & USE_MMAP_BIT)
#define enable_mmap(M)   ((M)->mflags |= USE_MMAP_BIT)
#define disable_mmap(M)   ((M)->mflags &= ~USE_MMAP_BIT)
#define use_noncontiguous(M)   ((M)->mflags & USE_NONCONTIGUOUS_BIT)
#define disable_contiguous(M)   ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
#define set_lock(M, L)
#define page_align(S)   (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
#define granularity_align(S)
#define mmap_align(S)   page_align(S)
#define SYS_ALLOC_PADDING   (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
#define is_page_aligned(S)   (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
#define is_granularity_aligned(S)   (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
#define segment_holds(S, A)   ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
#define should_trim(M, s)   ((s) > (M)->trim_check)
#define TOP_FOOT_SIZE   (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
#define PREACTION(M)   (0)
#define POSTACTION(M)
#define CORRUPTION_ERROR_ACTION(m)   ABORT
#define USAGE_ERROR_ACTION(m, p)   ABORT
#define check_free_chunk(M, P)
#define check_inuse_chunk(M, P)
#define check_malloced_chunk(M, P, N)
#define check_mmapped_chunk(M, P)
#define check_malloc_state(M)
#define check_top_chunk(M, P)
#define is_small(s)   (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
#define small_index(s)   ((s) >> SMALLBIN_SHIFT)
#define small_index2size(i)   ((i) << SMALLBIN_SHIFT)
#define MIN_SMALL_INDEX   (small_index(MIN_CHUNK_SIZE))
#define smallbin_at(M, i)   ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))
#define treebin_at(M, i)   (&((M)->treebins[i]))
#define compute_tree_index(S, I)
#define bit_for_tree_index(i)   (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
#define leftshift_for_tree_index(i)
#define minsize_for_tree_index(i)
#define idx2bit(i)   ((binmap_t)(1) << (i))
#define mark_smallmap(M, i)   ((M)->smallmap |= idx2bit(i))
#define clear_smallmap(M, i)   ((M)->smallmap &= ~idx2bit(i))
#define smallmap_is_marked(M, i)   ((M)->smallmap & idx2bit(i))
#define mark_treemap(M, i)   ((M)->treemap |= idx2bit(i))
#define clear_treemap(M, i)   ((M)->treemap &= ~idx2bit(i))
#define treemap_is_marked(M, i)   ((M)->treemap & idx2bit(i))
#define least_bit(x)   ((x) & -(x))
#define left_bits(x)   ((x<<1) | -(x<<1))
#define same_or_left_bits(x)   ((x) | -(x))
#define compute_bit2idx(X, I)
#define ok_address(M, a)   ((char*)(a) >= (M)->least_addr)
#define ok_next(p, n)   ((char*)(p) < (char*)(n))
#define ok_cinuse(p)   cinuse(p)
#define ok_pinuse(p)   pinuse(p)
#define ok_magic(M)   (1)
#define RTCHECK(e)   (e)
#define mark_inuse_foot(M, p, s)
#define set_inuse(M, p, s)
#define set_inuse_and_pinuse(M, p, s)
#define set_size_and_pinuse_of_inuse_chunk(M, p, s)   ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
#define insert_small_chunk(M, P, S)
#define unlink_small_chunk(M, P, S)
#define unlink_first_small_chunk(M, B, P, I)
#define replace_dv(M, P, S)
#define insert_large_chunk(M, X, S)
#define unlink_large_chunk(M, X)
#define insert_chunk(M, P, S)
#define unlink_chunk(M, P, S)
#define internal_malloc(m, b)   dlmalloc(b)
#define internal_free(m, mem)   dlfree(mem)
#define fm   gm

Typedefs

typedef struct malloc_chunk mchunk
typedef struct malloc_chunkmchunkptr
typedef struct malloc_chunksbinptr
typedef unsigned int bindex_t
typedef unsigned int binmap_t
typedef unsigned int flag_t
typedef struct malloc_tree_chunk tchunk
typedef struct malloc_tree_chunktchunkptr
typedef struct malloc_tree_chunktbinptr
typedef struct malloc_segment msegment
typedef struct malloc_segmentmsegmentptr
typedef struct malloc_statemstate

Functions

void * dlmalloc (size_t)
void dlfree (void *)
void * dlcalloc (size_t, size_t)
void * dlrealloc (void *, size_t)
void * dlmemalign (size_t, size_t)
void * dlvalloc (size_t)
int dlmallopt (int, int)
size_t dlmalloc_footprint (void)
size_t dlmalloc_max_footprint (void)
struct mallinfo dlmallinfo (void)
void ** dlindependent_calloc (size_t, size_t, void **)
void ** dlindependent_comalloc (size_t, size_t *, void **)
void * dlpvalloc (size_t)
int dlmalloc_trim (size_t)
void dlmalloc_stats (void)
size_t dlmalloc_usable_size (void *)
static msegmentptr segment_holding (mstate m, char *addr)
static int has_segment_link (mstate m, msegmentptr ss)
static int init_mparams (void)
static int change_mparam (int param_number, int value)
static struct mallinfo internal_mallinfo (mstate m)
static void internal_malloc_stats (mstate m)
static void * mmap_alloc (mstate m, size_t nb)
static mchunkptr mmap_resize (mstate m, mchunkptr oldp, size_t nb)
static void init_top (mstate m, mchunkptr p, size_t psize)
static void init_bins (mstate m)
static void * prepend_alloc (mstate m, char *newbase, char *oldbase, size_t nb)
static void add_segment (mstate m, char *tbase, size_t tsize, flag_t mmapped)
static void * sys_alloc (mstate m, size_t nb)
static size_t release_unused_segments (mstate m)
static int sys_trim (mstate m, size_t pad)
static void * tmalloc_large (mstate m, size_t nb)
static void * tmalloc_small (mstate m, size_t nb)
static void * internal_realloc (mstate m, void *oldmem, size_t bytes)
static void * internal_memalign (mstate m, size_t alignment, size_t bytes)
static void ** ialloc (mstate m, size_t n_elements, size_t *sizes, int opts, void *chunks[])
void ** dlindependent_calloc (size_t n_elements, size_t elem_size, void *chunks[])
void ** dlindependent_comalloc (size_t n_elements, size_t sizes[], void *chunks[])

Variables

static int dev_zero_fd = -1
static struct malloc_params mparams
static struct malloc_state _gm_


Define Documentation

#define ABORT   abort()

Definition at line 557 of file malloc.c.h.

Referenced by init_mparams().

#define ABORT_ON_ASSERT_FAILURE   1

Definition at line 560 of file malloc.c.h.

 
#define ACQUIRE_MALLOC_GLOBAL_LOCK (  ) 

Definition at line 1907 of file malloc.c.h.

Referenced by init_mparams(), InitPool(), sys_alloc(), and sys_trim().

#define align_as_chunk (  )     (mchunkptr)((A) + align_offset(chunk2mem(A)))

#define align_offset (  ) 

Value:

((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
  ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))

Definition at line 1441 of file malloc.c.h.

Referenced by add_segment(), init_top(), and mmap_alloc().

#define assert (  ) 

Definition at line 1295 of file malloc.c.h.

Referenced by TiXmlAttributeSet::Add(), add_segment(), GhoulPrimitive::OgreRenderableDrawer::AddIndex(), GhoulPrimitive::OgreRenderableDrawer::AddVertex(), TiXmlString::at(), Lugre::cRobRenderOp::Begin(), Lugre::cCamera::cCamera(), Lugre::cFIFO::cFIFO(), Lugre::cViewport_L::CreateRTTViewport(), Lugre::cFastBatch::cSubBatch::cSubBatch(), Lugre::cWidget::cWidget(), DestroyCaches(), Lugre::cDialog::DestroyWidget(), dlmalloc(), GhoulPrimitive::Primitive::Ellipse(), Lugre::cRobRenderOp::End(), Lugre::explodestr(), GhoulPrimitive::OgreRenderableDrawer::Finish(), Lugre::FreeOldUnusedParticleSystems(), Lugre::cSimpleBeam::getBoundingBox(), Lugre::cSimpleBeam::getBoundingRadius(), TiXmlBase::GetChar(), TiXmlBase::GetEntity(), Lugre::cOgreWrapper::GetEntityVertex(), Lugre::cNet::GetHostByName(), Lugre::MeshShape::GetMeshShape(), GetMSpace(), Lugre::cLuaBindDirect< Ogre::VertexDeclaration >::GetSingletonPtr(), Lugre::cLuaBind< Lugre::cBufferedMesh >::GetSingletonPtr(), Lugre::cSimpleBeam::getSquaredViewDepth(), GetThreadCache(), Lugre::cFIFO::HackGetRawWriter(), ialloc(), Lugre::cRobRenderOp::Index(), Lugre::cScripting::Init(), Lugre::cGfx2D::InitBase(), TiXmlNode::InsertAfterChild(), TiXmlNode::InsertBeforeChild(), internal_memalign(), TiXmlNode::IterateChildren(), l_OgreMaterialAvailable(), TiXmlNode::LinkEndChild(), TiXmlDocument::LoadFile(), Lugre::cLuaBind< Lugre::cBufferedMesh >::LuaRegister(), Lugre::macBundlePath(), Lugre::FindBasePaths::macBundlePath(), mmap_alloc(), nedblksize(), neddisablethreadcache(), nedpfree(), nedprealloc(), Lugre::cGfx3D::NewChildOfGfx3D(), Lugre::cGfx3D::NewChildOfRoot(), Lugre::cGfx3D::NewChildOfSceneNode(), Lugre::cGfx3D::NewFree(), Lugre::cGfx3D::NewOfSceneNode(), Lugre::cGfx3D::NewTagPoint(), TiXmlString::operator[](), TiXmlDocument::Parse(), GhoulPrimitive::OgreRenderableDrawer::Prepare(), Lugre::cRobRenderOp::PrepareAddVertex(), Lugre::cImage_L::PrepareImage(), prepend_alloc(), Lugre::cFIFO::PushRaw(), Lugre::cFIFO::PushRawFill(), TiXmlBase::ReadName(), Lugre::cTimer::RegisterFrameIntervalListener(), Lugre::cListenable::RegisterListener(), Lugre::cScripting::RegisterPlugin(), Lugre::cSmartPointable::RegisterSmartPtr(), cObjectController::Release(), release_unused_segments(), TiXmlAttributeSet::Remove(), RemoveCacheEntries(), TiXmlNode::RemoveChild(), Lugre::cFIFO::Reserve(), Lugre::cUDP_SendSocket::Send(), Lugre::cConnection::SendPush(), Lugre::cFastBatch::cSubBatch::SetDisplayRange(), TiXmlDocument::SetError(), Lugre::cBufferedVertexData::SetFromVertexData(), Lugre::cGfx3D::SetPrepareFrameStep(), Lugre::cGfx2D::SetPrepareFrameStep(), Lugre::cBufferedVertexData::SetQuickDataFromSemantic(), TiXmlParsingData::Stamp(), Lugre::cRobRenderOp::StartCustomWriter(), Lugre::cTimer::StartFrame(), cObject::Step(), Lugre::cConnection::Step(), TiXmlBase::StringEqual(), threadcache_free(), threadcache_malloc(), TiXmlParsingData::TiXmlParsingData(), tmalloc_large(), tmalloc_small(), Lugre::cListenable::UnRegisterListener(), Lugre::cSmartPointable::UnRegisterSmartPtr(), Lugre::cDialog::~cDialog(), cLocation::~cLocation(), cObjectController::~cObjectController(), Lugre::cScripting::~cScripting(), Lugre::cWidget::~cWidget(), and TiXmlAttributeSet::~TiXmlAttributeSet().

#define bit_for_tree_index (  )     (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)

Definition at line 2752 of file malloc.c.h.

#define CALL_DIRECT_MMAP (  )     DIRECT_MMAP_DEFAULT(s)

Definition at line 1563 of file malloc.c.h.

Referenced by mmap_alloc().

#define CALL_MMAP (  )     MMAP_DEFAULT(s)

Definition at line 1553 of file malloc.c.h.

Referenced by sys_alloc().

#define CALL_MORECORE (  )     MORECORE_DEFAULT(S)

Define CALL_MORECORE

Definition at line 1537 of file malloc.c.h.

Referenced by sys_alloc(), and sys_trim().

#define CALL_MREMAP ( addr,
osz,
nsz,
mv   )     MFAIL

Define CALL_MREMAP

Definition at line 1587 of file malloc.c.h.

Referenced by mmap_resize(), and sys_trim().

#define CALL_MUNMAP ( a,
 )     MUNMAP_DEFAULT((a), (s))

Definition at line 1558 of file malloc.c.h.

Referenced by dlfree(), release_unused_segments(), and sys_trim().

#define calloc_must_clear (  )     (!is_mmapped(p))

Definition at line 2162 of file malloc.c.h.

Referenced by dlcalloc().

#define check_free_chunk ( M,
 ) 

Definition at line 2646 of file malloc.c.h.

Referenced by dlfree(), and prepend_alloc().

#define check_inuse_chunk ( M,
 ) 

Definition at line 2647 of file malloc.c.h.

Referenced by dlfree(), ialloc(), internal_memalign(), and internal_realloc().

#define check_malloc_state (  ) 

Definition at line 2650 of file malloc.c.h.

Referenced by internal_mallinfo(), and internal_malloc_stats().

#define check_malloced_chunk ( M,
P,
 ) 

Definition at line 2648 of file malloc.c.h.

Referenced by dlmalloc(), prepend_alloc(), and sys_alloc().

#define check_mmapped_chunk ( M,
 ) 

Definition at line 2649 of file malloc.c.h.

Referenced by mmap_alloc(), and mmap_resize().

#define check_top_chunk ( M,
 ) 

Definition at line 2651 of file malloc.c.h.

Referenced by add_segment(), dlmalloc(), prepend_alloc(), sys_alloc(), and sys_trim().

#define chunk2mem (  )     ((void*)((char*)(p) + TWO_SIZE_T_SIZES))

#define CHUNK_ALIGN_MASK   (MALLOC_ALIGNMENT - SIZE_T_ONE)

Definition at line 1435 of file malloc.c.h.

Referenced by add_segment(), mmap_alloc(), and mmap_resize().

#define chunk_minus_offset ( p,
 )     ((mchunkptr)(((char*)(p)) - (s)))

Definition at line 2132 of file malloc.c.h.

Referenced by dlfree().

#define CHUNK_OVERHEAD   (SIZE_T_SIZE)

#define chunk_plus_offset ( p,
 )     ((mchunkptr)(((char*)(p)) + (s)))

#define chunksize (  )     ((p)->head & ~(FLAG_BITS))

#define cinuse (  )     ((p)->head & CINUSE_BIT)

#define CINUSE_BIT   (SIZE_T_TWO)

Definition at line 2114 of file malloc.c.h.

Referenced by internal_memalign(), mmap_alloc(), and mmap_resize().

#define clear_cinuse (  )     ((p)->head &= ~CINUSE_BIT)

Definition at line 2128 of file malloc.c.h.

#define clear_pinuse (  )     ((p)->head &= ~PINUSE_BIT)

Definition at line 2127 of file malloc.c.h.

#define clear_smallmap ( M,
 )     ((M)->smallmap &= ~idx2bit(i))

Definition at line 2773 of file malloc.c.h.

#define clear_treemap ( M,
 )     ((M)->treemap &= ~idx2bit(i))

Definition at line 2777 of file malloc.c.h.

#define CMFAIL   ((char*)(MFAIL))

Definition at line 1456 of file malloc.c.h.

Referenced by mmap_alloc(), mmap_resize(), sys_alloc(), and sys_trim().

#define compute_bit2idx ( X,
 ) 

Value:

{\
  unsigned int Y = X - 1;\
  unsigned int K = Y >> (16-4) & 16;\
  unsigned int N = K;        Y >>= K;\
  N += K = Y >> (8-3) &  8;  Y >>= K;\
  N += K = Y >> (4-2) &  4;  Y >>= K;\
  N += K = Y >> (2-1) &  2;  Y >>= K;\
  N += K = Y >> (1-0) &  1;  Y >>= K;\
  I = (bindex_t)(N + Y);\
}

Definition at line 2819 of file malloc.c.h.

Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().

#define compute_tree_index ( S,
 ) 

Value:

{\
  size_t X = S >> TREEBIN_SHIFT;\
  if (X == 0)\
    I = 0;\
  else if (X > 0xFFFF)\
    I = NTREEBINS-1;\
  else {\
    unsigned int Y = (unsigned int)X;\
    unsigned int N = ((Y - 0x100) >> 16) & 8;\
    unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\
    N += K;\
    N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\
    K = 14 - N + ((Y <<= K) >> 15);\
    I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\
  }\
}

Definition at line 2732 of file malloc.c.h.

Referenced by tmalloc_large().

#define CORRUPTION_ERROR_ACTION (  )     ABORT

Definition at line 2633 of file malloc.c.h.

Referenced by tmalloc_large(), and tmalloc_small().

#define DEBUG   0

Definition at line 1297 of file malloc.c.h.

#define DEFAULT_GRANULARITY   (0)

Definition at line 611 of file malloc.c.h.

#define DEFAULT_MMAP_THRESHOLD   ((size_t)256U * (size_t)1024U)

Definition at line 625 of file malloc.c.h.

Referenced by init_mparams().

#define DEFAULT_TRIM_THRESHOLD   ((size_t)2U * (size_t)1024U * (size_t)1024U)

Definition at line 618 of file malloc.c.h.

Referenced by init_mparams().

#define DIRECT_MMAP_DEFAULT (  )     MMAP_DEFAULT(s)

Definition at line 1482 of file malloc.c.h.

#define disable_contiguous (  )     ((M)->mflags |= USE_NONCONTIGUOUS_BIT)

Definition at line 2514 of file malloc.c.h.

Referenced by sys_alloc().

#define disable_lock (  )     ((M)->mflags &= ~USE_LOCK_BIT)

Definition at line 2507 of file malloc.c.h.

#define disable_mmap (  )     ((M)->mflags &= ~USE_MMAP_BIT)

Definition at line 2511 of file malloc.c.h.

Referenced by ialloc().

#define dlcalloc   calloc

Definition at line 749 of file malloc.c.h.

#define dlfree   free

Definition at line 750 of file malloc.c.h.

Referenced by dlrealloc().

#define dlindependent_calloc   independent_calloc

Definition at line 763 of file malloc.c.h.

#define dlindependent_comalloc   independent_comalloc

Definition at line 764 of file malloc.c.h.

#define dlmallinfo   mallinfo

Definition at line 756 of file malloc.c.h.

#define dlmalloc   malloc

Definition at line 751 of file malloc.c.h.

Referenced by dlcalloc(), and dlrealloc().

#define dlmalloc_footprint   malloc_footprint

Definition at line 761 of file malloc.c.h.

#define dlmalloc_max_footprint   malloc_max_footprint

Definition at line 762 of file malloc.c.h.

void dlmalloc_stats   malloc_stats

Definition at line 759 of file malloc.c.h.

#define dlmalloc_trim   malloc_trim

Definition at line 758 of file malloc.c.h.

#define dlmalloc_usable_size   malloc_usable_size

Definition at line 760 of file malloc.c.h.

#define DLMALLOC_VERSION   20804

Definition at line 484 of file malloc.c.h.

#define dlmallopt   mallopt

Definition at line 757 of file malloc.c.h.

#define dlmemalign   memalign

Definition at line 752 of file malloc.c.h.

Referenced by dlpvalloc(), and dlvalloc().

#define dlpvalloc   pvalloc

Definition at line 755 of file malloc.c.h.

#define dlrealloc   realloc

Definition at line 753 of file malloc.c.h.

#define dlvalloc   valloc

Definition at line 754 of file malloc.c.h.

#define enable_lock (  )     ((M)->mflags |= USE_LOCK_BIT)

Definition at line 2506 of file malloc.c.h.

#define enable_mmap (  )     ((M)->mflags |= USE_MMAP_BIT)

Definition at line 2510 of file malloc.c.h.

Referenced by ialloc().

 
#define ensure_initialization (  )     (mparams.magic != 0 || init_mparams())

#define EXTERN_BIT   (8U)

Definition at line 1594 of file malloc.c.h.

#define FENCEPOST_HEAD   (INUSE_BITS|SIZE_T_SIZE)

#define FLAG4_BIT   (SIZE_T_FOUR)

Definition at line 2115 of file malloc.c.h.

#define FLAG_BITS   (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)

Definition at line 2117 of file malloc.c.h.

#define fm   gm

#define FOOTERS   0

Definition at line 554 of file malloc.c.h.

#define FOUR_SIZE_T_SIZES   (SIZE_T_SIZE<<2)

Definition at line 1430 of file malloc.c.h.

Referenced by add_segment().

#define get_foot ( p,
 )     (((mchunkptr)((char*)(p) + (s)))->prev_foot)

Definition at line 2142 of file malloc.c.h.

#define gm   (&_gm_)

#define granularity_align (  ) 

Value:

Definition at line 2526 of file malloc.c.h.

Referenced by sys_alloc().

#define HALF_MAX_SIZE_T   (MAX_SIZE_T / 2U)

Definition at line 1432 of file malloc.c.h.

Referenced by sys_alloc(), and sys_trim().

#define HAVE_MMAP   1

Definition at line 579 of file malloc.c.h.

Referenced by sys_alloc(), and sys_trim().

#define HAVE_MORECORE   1

Definition at line 598 of file malloc.c.h.

Referenced by sys_alloc(), and sys_trim().

#define HAVE_MREMAP   0

Definition at line 588 of file malloc.c.h.

#define idx2bit (  )     ((binmap_t)(1) << (i))

Definition at line 2769 of file malloc.c.h.

Referenced by dlmalloc(), and tmalloc_large().

#define INITIAL_LOCK (  ) 

Definition at line 1900 of file malloc.c.h.

Referenced by init_mparams(), and InitPool().

#define INSECURE   0

Definition at line 576 of file malloc.c.h.

#define insert_chunk ( M,
P,
 ) 

Value:

if (is_small(S)) insert_small_chunk(M, P, S)\
  else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }

Definition at line 3626 of file malloc.c.h.

Referenced by add_segment(), prepend_alloc(), and tmalloc_large().

#define insert_large_chunk ( M,
X,
 ) 

Definition at line 3485 of file malloc.c.h.

Referenced by dlfree(), and release_unused_segments().

#define insert_small_chunk ( M,
P,
 ) 

Value:

{\
  bindex_t I  = small_index(S);\
  mchunkptr B = smallbin_at(M, I);\
  mchunkptr F = B;\
  assert(S >= MIN_CHUNK_SIZE);\
  if (!smallmap_is_marked(M, I))\
    mark_smallmap(M, I);\
  else if (RTCHECK(ok_address(M, B->fd)))\
    F = B->fd;\
  else {\
    CORRUPTION_ERROR_ACTION(M);\
  }\
  B->fd = P;\
  F->bk = P;\
  P->fd = F;\
  P->bk = B;\
}

Definition at line 3412 of file malloc.c.h.

Referenced by dlfree().

#define internal_free ( m,
mem   )     dlfree(mem)

Definition at line 3648 of file malloc.c.h.

Referenced by internal_memalign(), and internal_realloc().

#define internal_malloc ( m,
 )     dlmalloc(b)

Definition at line 3647 of file malloc.c.h.

Referenced by ialloc(), internal_memalign(), and internal_realloc().

#define INUSE_BITS   (PINUSE_BIT|CINUSE_BIT)

Definition at line 2116 of file malloc.c.h.

Referenced by dlfree().

#define is_aligned (  )     (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)

Definition at line 1438 of file malloc.c.h.

Referenced by add_segment(), mmap_alloc(), and nedgetvalue().

#define is_extern_segment (  )     ((S)->sflags & EXTERN_BIT)

Definition at line 2342 of file malloc.c.h.

Referenced by release_unused_segments(), sys_alloc(), and sys_trim().

#define is_global (  )     ((M) == &_gm_)

Definition at line 2495 of file malloc.c.h.

Referenced by sys_alloc().

#define is_granularity_aligned (  )     (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)

Definition at line 2543 of file malloc.c.h.

#define is_initialized (  )     ((M)->top != 0)

Definition at line 2499 of file malloc.c.h.

Referenced by internal_mallinfo(), internal_malloc_stats(), sys_alloc(), and sys_trim().

#define is_mmapped (  )     (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT))

Definition at line 2153 of file malloc.c.h.

Referenced by ialloc(), internal_memalign(), internal_realloc(), and nedgetvalue().

#define IS_MMAPPED_BIT   (SIZE_T_ONE)

Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP

Definition at line 1547 of file malloc.c.h.

Referenced by dlfree(), mmap_alloc(), mmap_resize(), and sys_alloc().

#define is_mmapped_segment (  )     ((S)->sflags & IS_MMAPPED_BIT)

Definition at line 2341 of file malloc.c.h.

Referenced by release_unused_segments(), and sys_trim().

#define is_page_aligned (  )     (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)

Definition at line 2541 of file malloc.c.h.

Referenced by sys_alloc().

#define is_small (  )     (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)

Definition at line 2677 of file malloc.c.h.

Referenced by dlfree(), and mmap_resize().

#define least_bit (  )     ((x) & -(x))

Definition at line 2781 of file malloc.c.h.

Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().

#define left_bits (  )     ((x<<1) | -(x<<1))

Definition at line 2784 of file malloc.c.h.

Referenced by dlmalloc(), and tmalloc_large().

#define leftmost_child (  )     ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])

Definition at line 2275 of file malloc.c.h.

Referenced by tmalloc_large(), and tmalloc_small().

#define leftshift_for_tree_index (  ) 

Value:

((i == NTREEBINS-1)? 0 : \
    ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))

Definition at line 2756 of file malloc.c.h.

Referenced by tmalloc_large().

#define M_GRANULARITY   (-2)

Definition at line 661 of file malloc.c.h.

Referenced by change_mparam().

#define M_MMAP_THRESHOLD   (-3)

Definition at line 662 of file malloc.c.h.

Referenced by change_mparam().

#define M_TRIM_THRESHOLD   (-1)

Definition at line 660 of file malloc.c.h.

Referenced by change_mparam().

#define MALLINFO_FIELD_TYPE   size_t

Definition at line 647 of file malloc.c.h.

#define MALLOC_ALIGNMENT   ((size_t)8U)

Definition at line 551 of file malloc.c.h.

Referenced by init_mparams(), and internal_memalign().

#define MALLOC_FAILURE_ACTION   errno = ENOMEM;

Definition at line 592 of file malloc.c.h.

Referenced by internal_memalign(), internal_realloc(), and sys_alloc().

#define malloc_getpagesize   ((size_t)4096U)

Definition at line 1404 of file malloc.c.h.

Referenced by init_mparams().

#define mark_inuse_foot ( M,
p,
 ) 

Definition at line 2901 of file malloc.c.h.

Referenced by mmap_alloc(), and mmap_resize().

#define mark_smallmap ( M,
 )     ((M)->smallmap |= idx2bit(i))

Definition at line 2772 of file malloc.c.h.

#define mark_treemap ( M,
 )     ((M)->treemap |= idx2bit(i))

Definition at line 2776 of file malloc.c.h.

#define MAX_RELEASE_CHECK_RATE   4095

Definition at line 632 of file malloc.c.h.

Referenced by release_unused_segments(), and sys_alloc().

#define MAX_REQUEST   ((-MIN_CHUNK_SIZE) << 2)

Definition at line 2089 of file malloc.c.h.

Referenced by dlmalloc(), internal_memalign(), internal_realloc(), and sys_trim().

#define MAX_SIZE_T   (~(size_t)0)

Definition at line 536 of file malloc.c.h.

Referenced by change_mparam(), dlcalloc(), dlmalloc(), init_mparams(), and sys_trim().

#define MAX_SMALL_REQUEST   (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)

Definition at line 2439 of file malloc.c.h.

Referenced by dlmalloc().

#define MAX_SMALL_SIZE   (MIN_LARGE_SIZE - SIZE_T_ONE)

Definition at line 2438 of file malloc.c.h.

#define MCHUNK_SIZE   (sizeof(mchunk))

Definition at line 2065 of file malloc.c.h.

Referenced by init_mparams().

#define mem2chunk ( mem   )     ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))

#define MFAIL   ((void*)(MAX_SIZE_T))

Definition at line 1455 of file malloc.c.h.

Referenced by sys_trim().

#define MIN_CHUNK_SIZE   ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)

#define MIN_LARGE_SIZE   (SIZE_T_ONE << TREEBIN_SHIFT)

Definition at line 2437 of file malloc.c.h.

#define MIN_REQUEST   (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)

Definition at line 2090 of file malloc.c.h.

Referenced by dlmalloc().

#define MIN_SMALL_INDEX   (small_index(MIN_CHUNK_SIZE))

Definition at line 2680 of file malloc.c.h.

#define minsize_for_tree_index (  ) 

Value:

((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) |  \
   (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))

Definition at line 2761 of file malloc.c.h.

#define mmap_align (  )     page_align(S)

Definition at line 2535 of file malloc.c.h.

Referenced by mmap_alloc(), and mmap_resize().

#define MMAP_CHUNK_OVERHEAD   (TWO_SIZE_T_SIZES)

Definition at line 2074 of file malloc.c.h.

#define MMAP_CLEARS   1

Definition at line 582 of file malloc.c.h.

#define MMAP_DEFAULT (  ) 

Value:

((dev_zero_fd < 0) ? \
           (dev_zero_fd = open("/dev/zero", O_RDWR), \
            mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
            mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))

Definition at line 1476 of file malloc.c.h.

#define MMAP_FLAGS   (MAP_PRIVATE)

Definition at line 1474 of file malloc.c.h.

#define MMAP_FOOT_PAD   (FOUR_SIZE_T_SIZES)

Definition at line 2076 of file malloc.c.h.

Referenced by dlfree(), mmap_alloc(), and mmap_resize().

#define MMAP_PROT   (PROT_READ|PROT_WRITE)

Definition at line 1462 of file malloc.c.h.

#define MORECORE_CONTIGUOUS   1

Definition at line 606 of file malloc.c.h.

Referenced by sys_alloc().

#define MORECORE_DEFAULT   sbrk

Definition at line 604 of file malloc.c.h.

#define MSPACES   0

Definition at line 547 of file malloc.c.h.

#define MUNMAP_DEFAULT ( a,
 )     munmap((a), (s))

Definition at line 1461 of file malloc.c.h.

#define next_chunk (  )     ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))

Definition at line 2135 of file malloc.c.h.

Referenced by internal_mallinfo(), internal_malloc_stats(), nedgetvalue(), and sys_alloc().

#define next_pinuse (  )     ((next_chunk(p)->head) & PINUSE_BIT)

Definition at line 2139 of file malloc.c.h.

Referenced by nedgetvalue().

#define NO_MALLINFO   0

Definition at line 644 of file malloc.c.h.

#define NO_SEGMENT_TRAVERSAL   0

Definition at line 650 of file malloc.c.h.

Referenced by release_unused_segments(), and sys_alloc().

#define NOINLINE

Definition at line 730 of file malloc.c.h.

#define NSMALLBINS   (32U)

Definition at line 2432 of file malloc.c.h.

#define NTREEBINS   (32U)

Definition at line 2433 of file malloc.c.h.

#define ok_address ( M,
 )     ((char*)(a) >= (M)->least_addr)

Definition at line 2863 of file malloc.c.h.

Referenced by dlfree(), internal_realloc(), nedgetvalue(), tmalloc_large(), and tmalloc_small().

#define ok_cinuse (  )     cinuse(p)

Definition at line 2867 of file malloc.c.h.

Referenced by dlfree(), and internal_realloc().

#define ok_magic (  )     (1)

Definition at line 2882 of file malloc.c.h.

Referenced by dlfree(), dlrealloc(), nedgetvalue(), and threadcache_free().

#define ok_next ( p,
 )     ((char*)(p) < (char*)(n))

Definition at line 2865 of file malloc.c.h.

Referenced by dlfree(), internal_realloc(), tmalloc_large(), and tmalloc_small().

#define ok_pinuse (  )     pinuse(p)

Definition at line 2869 of file malloc.c.h.

Referenced by dlfree(), and internal_realloc().

#define ONLY_MSPACES   0

Definition at line 539 of file malloc.c.h.

#define overhead_for (  )     (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)

Definition at line 2157 of file malloc.c.h.

Referenced by dlmalloc_usable_size(), internal_realloc(), and nedblksize().

#define pad_request ( req   )     (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)

Definition at line 2093 of file malloc.c.h.

Referenced by add_segment(), and dlmalloc().

#define page_align (  )     (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))

Definition at line 2522 of file malloc.c.h.

Referenced by sys_alloc().

#define pinuse (  )     ((p)->head & PINUSE_BIT)

Definition at line 2124 of file malloc.c.h.

Referenced by dlfree(), nedgetvalue(), and prepend_alloc().

#define PINUSE_BIT   (SIZE_T_ONE)

Definition at line 2113 of file malloc.c.h.

Referenced by dlfree(), dlmalloc(), init_top(), internal_realloc(), prepend_alloc(), and sys_alloc().

#define POSTACTION (  ) 

#define PREACTION (  )     (0)

#define prev_chunk (  )     ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))

Definition at line 2136 of file malloc.c.h.

Referenced by nedgetvalue().

#define PROCEED_ON_ERROR   0

Definition at line 563 of file malloc.c.h.

 
#define RELEASE_MALLOC_GLOBAL_LOCK (  ) 

Definition at line 1908 of file malloc.c.h.

Referenced by init_mparams(), InitPool(), sys_alloc(), and sys_trim().

#define replace_dv ( M,
P,
 ) 

Value:

{\
  size_t DVS = M->dvsize;\
  if (DVS != 0) {\
    mchunkptr DV = M->dv;\
    assert(is_small(DVS));\
    insert_small_chunk(M, DV, DVS);\
  }\
  M->dvsize = S;\
  M->dv = P;\
}

Definition at line 3471 of file malloc.c.h.

Referenced by dlmalloc(), and tmalloc_small().

#define request2size ( req   )     (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))

Definition at line 2097 of file malloc.c.h.

Referenced by ialloc(), internal_memalign(), and internal_realloc().

#define RTCHECK (  )     (e)

Definition at line 2891 of file malloc.c.h.

Referenced by dlfree(), internal_realloc(), tmalloc_large(), and tmalloc_small().

#define same_or_left_bits (  )     ((x) | -(x))

Definition at line 2787 of file malloc.c.h.

#define segment_holds ( S,
 )     ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)

#define set_foot ( p,
 )     (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))

Definition at line 2143 of file malloc.c.h.

#define set_free_with_pinuse ( p,
s,
 )     (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))

Definition at line 2150 of file malloc.c.h.

Referenced by add_segment(), dlfree(), and prepend_alloc().

#define set_inuse ( M,
p,
 ) 

Value:

((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
  ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)

Definition at line 2904 of file malloc.c.h.

Referenced by internal_memalign(), and internal_realloc().

#define set_inuse_and_pinuse ( M,
p,
 ) 

Value:

((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
  ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)

Definition at line 2909 of file malloc.c.h.

Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().

#define set_lock ( M,
 ) 

Value:

((M)->mflags = (L)?\
  ((M)->mflags | USE_LOCK_BIT) :\
  ((M)->mflags & ~USE_LOCK_BIT))

Definition at line 2516 of file malloc.c.h.

#define set_size_and_pinuse_of_free_chunk ( p,
 )     ((p)->head = (s|PINUSE_BIT), set_foot(p, s))

Definition at line 2146 of file malloc.c.h.

Referenced by dlfree(), dlmalloc(), prepend_alloc(), tmalloc_large(), and tmalloc_small().

#define set_size_and_pinuse_of_inuse_chunk ( M,
p,
 )     ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))

#define should_trim ( M,
 )     ((s) > (M)->trim_check)

Definition at line 2573 of file malloc.c.h.

Referenced by dlfree().

#define SIX_SIZE_T_SIZES   (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)

Definition at line 1431 of file malloc.c.h.

Referenced by mmap_alloc(), and mmap_resize().

#define SIZE_T_BITSIZE   (sizeof(size_t) << 3)

Definition at line 1421 of file malloc.c.h.

Referenced by tmalloc_large().

#define SIZE_T_FOUR   ((size_t)4)

Definition at line 1428 of file malloc.c.h.

#define SIZE_T_ONE   ((size_t)1)

#define SIZE_T_SIZE   (sizeof(size_t))

Definition at line 1420 of file malloc.c.h.

Referenced by add_segment(), dlmalloc(), ialloc(), mmap_alloc(), and mmap_resize().

#define SIZE_T_TWO   ((size_t)2)

Definition at line 1427 of file malloc.c.h.

#define SIZE_T_ZERO   ((size_t)0)

Definition at line 1425 of file malloc.c.h.

#define small_index (  )     ((s) >> SMALLBIN_SHIFT)

Definition at line 2678 of file malloc.c.h.

Referenced by dlmalloc().

#define small_index2size (  )     ((i) << SMALLBIN_SHIFT)

Definition at line 2679 of file malloc.c.h.

Referenced by dlmalloc().

#define smallbin_at ( M,
 )     ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))

Definition at line 2683 of file malloc.c.h.

Referenced by dlmalloc(), and init_bins().

#define SMALLBIN_SHIFT   (3U)

Definition at line 2434 of file malloc.c.h.

#define SMALLBIN_WIDTH   (SIZE_T_ONE << SMALLBIN_SHIFT)

Definition at line 2435 of file malloc.c.h.

#define smallmap_is_marked ( M,
 )     ((M)->smallmap & idx2bit(i))

Definition at line 2774 of file malloc.c.h.

#define STRUCT_MALLINFO_DECLARED   1

Definition at line 695 of file malloc.c.h.

#define SYS_ALLOC_PADDING   (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)

Definition at line 2539 of file malloc.c.h.

Referenced by sys_alloc().

#define TOP_FOOT_SIZE   (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)

#define treebin_at ( M,
 )     (&((M)->treebins[i]))

Definition at line 2684 of file malloc.c.h.

Referenced by tmalloc_large(), and tmalloc_small().

#define TREEBIN_SHIFT   (8U)

Definition at line 2436 of file malloc.c.h.

#define treemap_is_marked ( M,
 )     ((M)->treemap & idx2bit(i))

Definition at line 2778 of file malloc.c.h.

#define TWO_SIZE_T_SIZES   (SIZE_T_SIZE<<1)

Definition at line 1429 of file malloc.c.h.

#define unlink_chunk ( M,
P,
 ) 

Value:

if (is_small(S)) unlink_small_chunk(M, P, S)\
  else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }

Definition at line 3630 of file malloc.c.h.

Referenced by dlfree(), and prepend_alloc().

#define unlink_first_small_chunk ( M,
B,
P,
 ) 

Value:

{\
  mchunkptr F = P->fd;\
  assert(P != B);\
  assert(P != F);\
  assert(chunksize(P) == small_index2size(I));\
  if (B == F)\
    clear_smallmap(M, I);\
  else if (RTCHECK(ok_address(M, F))) {\
    B->fd = F;\
    F->bk = B;\
  }\
  else {\
    CORRUPTION_ERROR_ACTION(M);\
  }\
}

Definition at line 3451 of file malloc.c.h.

Referenced by dlmalloc().

#define unlink_large_chunk ( M,
 ) 

Definition at line 3553 of file malloc.c.h.

Referenced by release_unused_segments(), tmalloc_large(), and tmalloc_small().

#define unlink_small_chunk ( M,
P,
 ) 

Value:

{\
  mchunkptr F = P->fd;\
  mchunkptr B = P->bk;\
  bindex_t I = small_index(S);\
  assert(P != B);\
  assert(P != F);\
  assert(chunksize(P) == small_index2size(I));\
  if (F == B)\
    clear_smallmap(M, I);\
  else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\
                   (B == smallbin_at(M,I) || ok_address(M, B)))) {\
    F->bk = B;\
    B->fd = F;\
  }\
  else {\
    CORRUPTION_ERROR_ACTION(M);\
  }\
}

Definition at line 3431 of file malloc.c.h.

#define USAGE_ERROR_ACTION ( m,
 )     ABORT

Definition at line 2637 of file malloc.c.h.

Referenced by dlfree(), dlrealloc(), internal_realloc(), and threadcache_free().

#define USE_BUILTIN_FFS   0

Definition at line 638 of file malloc.c.h.

#define USE_DEV_RANDOM   0

Definition at line 641 of file malloc.c.h.

#define use_lock (  )     ((M)->mflags & USE_LOCK_BIT)

Definition at line 2505 of file malloc.c.h.

#define USE_LOCK_BIT   (0U)

Definition at line 1899 of file malloc.c.h.

Referenced by init_mparams().

#define USE_LOCKS   0

Definition at line 566 of file malloc.c.h.

#define use_mmap (  )     ((M)->mflags & USE_MMAP_BIT)

Definition at line 2509 of file malloc.c.h.

Referenced by ialloc(), and sys_alloc().

#define USE_MMAP_BIT   (SIZE_T_ONE)

Definition at line 1548 of file malloc.c.h.

Referenced by init_mparams().

#define use_noncontiguous (  )     ((M)->mflags & USE_NONCONTIGUOUS_BIT)

Definition at line 2513 of file malloc.c.h.

Referenced by sys_alloc().

#define USE_NONCONTIGUOUS_BIT   (4U)

Definition at line 1591 of file malloc.c.h.

Referenced by init_mparams().

#define USE_SPIN_LOCKS   0

Definition at line 572 of file malloc.c.h.


Typedef Documentation

typedef unsigned int bindex_t

Definition at line 2059 of file malloc.c.h.

typedef unsigned int binmap_t

Definition at line 2060 of file malloc.c.h.

typedef unsigned int flag_t

Definition at line 2061 of file malloc.c.h.

typedef struct malloc_chunk mchunk

Definition at line 2056 of file malloc.c.h.

typedef struct malloc_chunk* mchunkptr

Definition at line 2057 of file malloc.c.h.

typedef struct malloc_segment msegment

Definition at line 2344 of file malloc.c.h.

typedef struct malloc_segment* msegmentptr

Definition at line 2345 of file malloc.c.h.

typedef struct malloc_state* mstate

Definition at line 2465 of file malloc.c.h.

typedef struct malloc_chunk* sbinptr

Definition at line 2058 of file malloc.c.h.

typedef struct malloc_tree_chunk* tbinptr

Definition at line 2272 of file malloc.c.h.

typedef struct malloc_tree_chunk tchunk

Definition at line 2270 of file malloc.c.h.

typedef struct malloc_tree_chunk* tchunkptr

Definition at line 2271 of file malloc.c.h.


Function Documentation

static void add_segment ( mstate  m,
char *  tbase,
size_t  tsize,
flag_t  mmapped 
) [static]

static int change_mparam ( int  param_number,
int  value 
) [static]

void * dlcalloc ( size_t  n_elements,
size_t  elem_size 
)

Definition at line 4831 of file malloc.c.h.

References calloc_must_clear, dlmalloc, MAX_SIZE_T, and mem2chunk.

void dlfree ( void *  mem  ) 

void** dlindependent_calloc ( size_t  n_elements,
size_t  elem_size,
void *  chunks[] 
)

Definition at line 4873 of file malloc.c.h.

References gm, and ialloc().

void** dlindependent_calloc ( size_t  ,
size_t  ,
void **   
)

void** dlindependent_comalloc ( size_t  n_elements,
size_t  sizes[],
void *  chunks[] 
)

Definition at line 4879 of file malloc.c.h.

References gm, and ialloc().

void** dlindependent_comalloc ( size_t  ,
size_t *  ,
void **   
)

struct mallinfo dlmallinfo ( void   )  [read]

Definition at line 4917 of file malloc.c.h.

References gm, and internal_mallinfo().

void * dlmalloc ( size_t  bytes  ) 

size_t dlmalloc_footprint ( void   ) 

Definition at line 4908 of file malloc.c.h.

References gm.

size_t dlmalloc_max_footprint ( void   ) 

Definition at line 4912 of file malloc.c.h.

References gm.

void dlmalloc_stats ( void   ) 

int dlmalloc_trim ( size_t  pad  ) 

Definition at line 4898 of file malloc.c.h.

References ensure_initialization, gm, POSTACTION, PREACTION, and sys_trim().

size_t dlmalloc_usable_size ( void *  mem  ) 

Definition at line 4932 of file malloc.c.h.

References chunksize, cinuse, mem2chunk, and overhead_for.

int dlmallopt ( int  param_number,
int  value 
)

Definition at line 4926 of file malloc.c.h.

References change_mparam().

void * dlmemalign ( size_t  alignment,
size_t  bytes 
)

Definition at line 4869 of file malloc.c.h.

References gm, and internal_memalign().

void * dlpvalloc ( size_t  bytes  ) 

void * dlrealloc ( void *  oldmem,
size_t  bytes 
)

Definition at line 4846 of file malloc.c.h.

References dlfree, dlmalloc, gm, internal_realloc(), mem2chunk, ok_magic, and USAGE_ERROR_ACTION.

void * dlvalloc ( size_t  bytes  ) 

Definition at line 4884 of file malloc.c.h.

References dlmemalign, ensure_initialization, mparams, and malloc_params::page_size.

static int has_segment_link ( mstate  m,
msegmentptr  ss 
) [static]

Definition at line 2562 of file malloc.c.h.

References malloc_segment::base, malloc_segment::next, malloc_state::seg, and malloc_segment::size.

Referenced by sys_trim().

static void** ialloc ( mstate  m,
size_t  n_elements,
size_t *  sizes,
int  opts,
void *  chunks[] 
) [static]

static void init_bins ( mstate  m  )  [static]

Definition at line 3743 of file malloc.c.h.

References malloc_chunk::bk, malloc_chunk::fd, and smallbin_at.

Referenced by sys_alloc().

static int init_mparams ( void   )  [static]

static void init_top ( mstate  m,
mchunkptr  p,
size_t  psize 
) [static]

static struct mallinfo internal_mallinfo ( mstate  m  )  [static, read]

static void internal_malloc_stats ( mstate  m  )  [static]

static void* internal_memalign ( mstate  m,
size_t  alignment,
size_t  bytes 
) [static]

static void* internal_realloc ( mstate  m,
void *  oldmem,
size_t  bytes 
) [static]

static void* mmap_alloc ( mstate  m,
size_t  nb 
) [static]

static mchunkptr mmap_resize ( mstate  m,
mchunkptr  oldp,
size_t  nb 
) [static]

static void* prepend_alloc ( mstate  m,
char *  newbase,
char *  oldbase,
size_t  nb 
) [static]

static size_t release_unused_segments ( mstate  m  )  [static]

static msegmentptr segment_holding ( mstate  m,
char *  addr 
) [static]

static void* sys_alloc ( mstate  m,
size_t  nb 
) [static]

static int sys_trim ( mstate  m,
size_t  pad 
) [static]

static void* tmalloc_large ( mstate  m,
size_t  nb 
) [static]

static void* tmalloc_small ( mstate  m,
size_t  nb 
) [static]


Variable Documentation

struct malloc_state _gm_ [static]

Definition at line 2493 of file malloc.c.h.

int dev_zero_fd = -1 [static]

Definition at line 1475 of file malloc.c.h.

struct malloc_params mparams [static]


Generated on Wed May 23 06:00:16 2012 for cpp by  doxygen 1.5.6