#include "utils/memdebug.h"
#include "utils/memutils.h"
-/* Define this to detail debug alloc information */
-/* #define HAVE_ALLOCINFO */
-
/*--------------------
* Chunk freelist k holds chunks of size 1 << (k + ALLOC_MINBITS),
* for k = 0 .. ALLOCSET_NUM_FREELISTS-1.
#endif
};
-/* ----------
- * Debug macros
- * ----------
- */
-#ifdef HAVE_ALLOCINFO
-#define AllocFreeInfo(_cxt, _chunk) \
- fprintf(stderr, "AllocFree: %s: %p, %zu\n", \
- (_cxt)->header.name, (_chunk), (_chunk)->size)
-#define AllocAllocInfo(_cxt, _chunk) \
- fprintf(stderr, "AllocAlloc: %s: %p, %zu\n", \
- (_cxt)->header.name, (_chunk), (_chunk)->size)
-#else
-#define AllocFreeInfo(_cxt, _chunk)
-#define AllocAllocInfo(_cxt, _chunk)
-#endif
/* ----------
* AllocSetFreeIndex -
set->blocks = block;
}
- AllocAllocInfo(set, chunk);
-
/* Ensure any padding bytes are marked NOACCESS. */
VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
chunk_size - size);
randomize_mem((char *) AllocChunkGetPointer(chunk), size);
#endif
- AllocAllocInfo(set, chunk);
-
/* Ensure any padding bytes are marked NOACCESS. */
VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
chunk->size - size);
randomize_mem((char *) AllocChunkGetPointer(chunk), size);
#endif
- AllocAllocInfo(set, chunk);
-
/* Ensure any padding bytes are marked NOACCESS. */
VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
chunk_size - size);
/* Allow access to private part of chunk header. */
VALGRIND_MAKE_MEM_DEFINED(chunk, ALLOCCHUNK_PRIVATE_LEN);
- AllocFreeInfo(set, chunk);
-
#ifdef MEMORY_CONTEXT_CHECKING
/* Test for someone scribbling on unused space in chunk */
if (chunk->requested_size < chunk->size)
#endif
};
-/* ----------
- * Debug macros
- * ----------
- */
-#ifdef HAVE_ALLOCINFO
-#define GenerationFreeInfo(_cxt, _chunk) \
- fprintf(stderr, "GenerationFree: %s: %p, %lu\n", \
- (_cxt)->name, (_chunk), (_chunk)->size)
-#define GenerationAllocInfo(_cxt, _chunk) \
- fprintf(stderr, "GenerationAlloc: %s: %p, %lu\n", \
- (_cxt)->name, (_chunk), (_chunk)->size)
-#else
-#define GenerationFreeInfo(_cxt, _chunk)
-#define GenerationAllocInfo(_cxt, _chunk)
-#endif
-
/*
* Public routines
/* add the block to the list of allocated blocks */
dlist_push_head(&set->blocks, &block->node);
- GenerationAllocInfo(set, chunk);
-
/* Ensure any padding bytes are marked NOACCESS. */
VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
chunk_size - size);
randomize_mem((char *) GenerationChunkGetPointer(chunk), size);
#endif
- GenerationAllocInfo(set, chunk);
-
/* Ensure any padding bytes are marked NOACCESS. */
VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
chunk_size - size);
#endif
};
-/* ----------
- * Debug macros
- * ----------
- */
-#ifdef HAVE_ALLOCINFO
-#define SlabFreeInfo(_cxt, _chunk) \
- fprintf(stderr, "SlabFree: %s: %p, %zu\n", \
- (_cxt)->header.name, (_chunk), (_chunk)->header.size)
-#define SlabAllocInfo(_cxt, _chunk) \
- fprintf(stderr, "SlabAlloc: %s: %p, %zu\n", \
- (_cxt)->header.name, (_chunk), (_chunk)->header.size)
-#else
-#define SlabFreeInfo(_cxt, _chunk)
-#define SlabAllocInfo(_cxt, _chunk)
-#endif
-
/*
* SlabContextCreate
randomize_mem((char *) SlabChunkGetPointer(chunk), size);
#endif
- SlabAllocInfo(slab, chunk);
-
Assert(slab->nblocks * slab->blockSize == context->mem_allocated);
return SlabChunkGetPointer(chunk);
SlabChunk *chunk = SlabPointerGetChunk(pointer);
SlabBlock *block = chunk->block;
- SlabFreeInfo(slab, chunk);
-
#ifdef MEMORY_CONTEXT_CHECKING
/* Test for someone scribbling on unused space in chunk */
if (slab->chunkSize < (slab->fullChunkSize - sizeof(SlabChunk)))