22static void*
__omDebugRealloc(
void* old_addr,
void* old_size_bin,
void* new_size_bin,
25 char track, OM_FLR_DECL);
39#define OM_CLFL check_level OM_FL_KOMMA OM_FL
100#define MAX(a,b) (a > b ? a : b)
102#define MIN(a,b) (a < b ? a : b)
139#ifdef OM_INTERNAL_DEBUG
150 void* new_addr =
NULL;
168 new_size_bin = (
void*) 1;
173 status, old_flags, new_flags, track, OM_FLR_VAL);
174#ifdef OM_INTERNAL_DEBUG
193#ifdef OM_INTERNAL_DEBUG
224#ifdef OM_INTERNAL_DEBUG
259 while ((addr[
i] !=
'\0') )
i++;
269 memcpy(ret, addr,
i);
272#ifdef OM_INTERNAL_DEBUG
311 o_addr = omAllocTrackAddr(size_bin,
flags, track, OM_FLR_VAL);
327 size_t o_size = (
flags &
OM_FBIN ? ((
omBin)size_bin)->sizeW << LOG_SIZEOF_LONG : (size_bin !=
NULL ? (size_t) size_bin: 1));
330#ifdef OM_ALIGNMENT_NEEDS_WORK
339#ifdef OM_ALIGNMENT_NEEDS_WORK
354 char track, OM_FLR_DECL)
357 size_t old_size = (old_flags &
OM_FSIZE ? (size_t) old_size_bin :
365 new_addr =
__omDebugAlloc(new_size_bin, new_flags, track, OM_FLR_VAL);
370 new_addr =
__omDebugAlloc(new_size_bin, new_flags, track, OM_FLR_VAL);
374 memcpy(new_addr, old_addr, (old_size < new_size ? old_size : new_size));
376 if ((new_flags &
OM_FZERO) && new_size > old_size)
377 memset((
char *)new_addr + old_size, 0, new_size - old_size);
379 __omDebugFree(old_addr, old_size_bin, old_flags, OM_FLR_VAL);
396 new_size = (size_t) new_size_bin;
397 if (new_size == 0) new_size = 1;
402 size_t old_size = (size_t) old_size_bin;
406#ifdef OM_ALIGNMENT_NEEDS_WORK
415#ifdef OM_ALIGNMENT_NEEDS_WORK
427#ifdef OM_ALIGNMENT_NEEDS_WORK
436#ifdef OM_ALIGNMENT_NEEDS_WORK
474 addr = omMarkAsFreeTrackAddr(addr, 1, &
flags, OM_FLR_VAL);
499 *((
void**) addr) =
NULL;
527 omMarkAsFreeTrackAddr(addr, 0, &
flags, OM_FLR_VAL);
528 omFreeTrackAddr(addr);
545 void* prev_addr =
NULL;
551 next_addr = *((
void**) addr);
554 if (prev_addr !=
NULL)
555 *((
void**) prev_addr) = next_addr;
564 omMarkAsFreeTrackAddr(addr, 0, &
flags, OM_FLR);
565 omFreeTrackAddr(addr);
583 next_addr = *((
void**) addr);
586 if (prev_addr !=
NULL)
587 *((
void**) prev_addr) = next_addr;
593 omMarkAsFreeTrackAddr(addr, 0, &
flags, OM_FLR);
594 omFreeTrackAddr(addr);
626 next = *((
void**)addr);
632 omMarkAsFreeTrackAddr(addr, 0, &
flags, OM_FLR);
633 omFreeTrackAddr(addr);
#define __omTypeRealloc0Size(old_addr, old_size, new_type, new_addr, new_size)
#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin)
#define __omTypeAlloc0Bin(type, addr, bin)
#define omGetTopBinOfAddr(addr)
#define __omFreeBinAddr(addr)
#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin)
#define __omTypeRealloc(old_addr, new_type, new_addr, new_size)
#define __omTypeRealloc0(old_addr, new_type, new_addr, new_size)
#define __omTypeAllocBin(type, addr, bin)
#define __omTypeRealloc0Aligned
#define __omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size)
#define __omTypeAlloc0(type, addr, size)
#define __omTypeAlloc(type, addr, size)
#define __omTypeRealloc0AlignedSize
#define __omTypeAllocAligned
#define __omTypeAlloc0Aligned
#define __omTypeReallocAligned
#define __omFreeSize(addr, size)
#define __omTypeReallocAlignedSize
size_t omSizeOfAddr(const void *addr)
#define omIsBinPageAddr(addr)
#define omUnGetSpecBin(bin_ptr)
omError_t omTestBinAddr(void *addr, int check_level)
omError_t omTestBin(omBin bin, int check_level)
omError_t omTestAddrSize(void *addr, size_t size, int check_level)
void * om_AlwaysKeptAddrs
omError_t omtestAddr(void *addr, int check_level)
void * _omDebugRealloc(void *old_addr, void *old_size_bin, void *new_size_bin, omTrackFlags_t old_flags, omTrackFlags_t new_flags, OM_CTFL_DECL)
static omBin omGetOrigSpecBinOfAddr(void *addr)
omError_t omtestAddrSize(void *addr, size_t size, int check_level)
void * _omDebugMemDup(void *addr, omTrackFlags_t flags, OM_CTFL_DECL)
static void * __omDebugAlloc(void *size_bin, omTrackFlags_t flags, char track, OM_FLR_DECL)
omError_t omTestMemory(int check_level)
omError_t omtestAddrAlignedSize(void *addr, size_t size, int check_level)
omError_t omTestAddr(void *addr, int check_level)
static unsigned long om_NumberOfKeptAddrs
void * _omDebugAlloc(void *size_bin, omTrackFlags_t flags, OM_CTFL_DECL)
omError_t omTestAddrAligned(void *addr, int check_level)
omError_t _omDebugBin(omBin bin, OM_CFL_DECL)
char * _omDebugStrDup(const char *addr, OM_TFL_DECL)
void omFreeKeptAddrFromBin(omBin bin)
omError_t omtestAddrAligned(void *addr, int check_level)
omError_t _omDebugAddr(void *addr, void *bin_size, omTrackFlags_t flags, OM_CFL_DECL)
static void * __omDebugRealloc(void *old_addr, void *old_size_bin, void *new_size_bin, omError_t old_status, omTrackFlags_t old_flags, omTrackFlags_t new_flags, char track, OM_FLR_DECL)
omError_t omTestAddrBin(void *addr, omBin bin, int check_level)
omError_t omTestAddrAlignedBin(void *addr, omBin bin, int check_level)
static void __omDebugFree(void *addr, void *size_bin, omTrackFlags_t flags, OM_FLR_DECL)
void _omDebugFree(void *addr, void *size_bin, omTrackFlags_t flags, OM_CFL_DECL)
omError_t omTestAddrAlignedSize(void *addr, size_t size, int check_level)
omError_t _omDebugMemory(OM_CFL_DECL)
omError_t _omCheckBin(omBin bin, int normal_bin, char check, omError_t report, OM_FLR_DECL)
omError_t _omCheckAddr(void *addr, void *size_bin, omTrackFlags_t flags, char check, omError_t report, OM_FLR_DECL)
omError_t omDoCheckAddr(void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
omError_t _omCheckMemory(char check, omError_t report, OM_FLR_DECL)
omError_t omDoCheckBin(omBin bin, int normal_bin, char level, omError_t report, OM_FLR_DECL)
unsigned short omTrackFlags_t
omError_t omReportAddrError(omError_t error, omError_t report, void *addr, void *bin_size, omTrackFlags_t flags, OM_FLR_DECL, const char *fmt,...)
#define omIsBinAddrTrackAddr(addr)
#define omIsTrackAddr(addr)
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
@ omError_MemoryCorrupted
#define omFindInGList(ptr, next, what, value)
#define omMemcpyW(p1, p2, l)
int status int void size_t count int const void size_t count const char int flags
#define omTestBinAddrSize(A, B, C)