4#define OM_CHECK CHECK_LEVEL
17#if defined (__hpux) || defined (__alpha) || defined (__svr4__) || defined (__SVR4)
19#if defined (__hpux) || defined (__svr4__) || defined (__SVR4)
28static void srandom(
long seed)
42 if (cell->bin !=
NULL)
58 if (!OM_IS_ALIGNED(cell->addr))
61 "addr:%p is unaligned", cell->addr);
65 if (
IS_ALIGNED(cell->spec) && !OM_IS_STRICT_ALIGNED(cell->addr))
68 "addr:%p is not strict unaligned", cell->addr);
76 "is_size==%u < size==%u", is_size,
size);
83 "is_sizeW==%u < sizeW==%u", is_size >> LOG_SIZEOF_LONG,
omSizeWOfAddr(cell->addr));
93 size_t sizeW = OM_ALIGN_SIZE(
size) >> LOG_SIZEOF_LONG;
95 for (
i=0;
i<sizeW;
i++)
97 if (((
unsigned long*)s1)[
i] != ((
unsigned long*)s2)[
i])
100 "s1[%u]==%d != s2[%u]==%d",
i, ((
unsigned long*)s1)[
i],
i, ((
unsigned long*)s2)[
i]);
108 size_t sizeW = OM_ALIGN_SIZE(
size) >> LOG_SIZEOF_LONG;
111 if (!OM_IS_ALIGNED(addr))
114 "addr %p unaligned", addr);
118 for (
i=0;
i<sizeW;
i++)
120 if (((
unsigned long*)addr)[
i] != value)
123 "word %d modified: is %u should be %u",
i, ((
unsigned long*)addr)[
i], value);
138#if END_CHECK_LEVEL > 0
152 if ((
i % 10000) == 0)
168 unsigned long spec = random() + 1;
254 if (cell->addr !=
NULL)
278 if (sticky_bin ==
NULL)
290 if (cell[
i].orig_bin !=
NULL)
295 cell[
i].bin = cell[
i].orig_bin;
296 cell[
i].orig_bin =
NULL;
305 omBin next_bin = bin->next;
320 printf(
"\nomtTest Summary: ");
336int main(
int argc,
char* argv[])
338 int i=0, error_test = 1;
339 unsigned long spec,
j;
343 int last_kept_freed = 0;
355 if (argc > 1) sscanf(argv[1],
"%d", &error_test);
356 if (argc > 2) sscanf(argv[2],
"%d", &
seed);
359 if (argc > 3) sscanf(argv[3],
"%d", &n);
360 if (argc > 4) sscanf(argv[4],
"%d", &decr);
362 if (decr < 2) decr = 2;
363 printf(
"seed == %d\n",
seed);
370 printf(
"\nCells: %d KeptAddr:%d AlwaysKeptAddr:%d\n", n_cells,
378 printf(
"Checking Memory and all cells ");
386#if CHECK_LEVEL > 0 && TRACK_LEVEL > 0
387 if (error_test &&
errors == 0)
406 if (
om_Info.CurrentRegionsAlloc > 0)
414 if (n <= 0 || n_cells <= 100)
420 n_cells = n_cells / decr;
468 printf(
"%d:",
i / 1000);
475 if ((
i % 10000) == 0 &&
i != n_cells &&
i!=last_kept_freed)
495int main(
int argc,
char* argv[])
#define omDebugAddrAlignedBin
omError_t omTestMemory(int check_level)
#define omDebugAddrAlignedSize
#define omDebugAddrSize(addr, size)
#define omDebugAddrBin(addr, bin)
#define __omFreeBinAddr(addr)
size_t omSizeOfAddr(const void *addr)
void * om_AlwaysKeptAddrs
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
#define omInitGetBackTrace()
#define omFindInGList(ptr, next, what, value)
#define omRemoveFromGList(ptr, next, addr)
#define omListLength(ptr)
#define omIsOnGList(ptr, next, addr)
#define omMemsetW(P1, W, L)
omBinPage_t om_ZeroPage[]
void TestAlloc(omMemCell cell, unsigned long spec)
void TestAddrContent(void *addr, unsigned long value, size_t size)
omBin omtGetStickyBin(omBin bin)
omMemCell_t cells[MAX_CELLS]
void TestFree(omMemCell cell)
void omtMergeStickyBins(omMemCell cell, int n)
void TestRealloc(omMemCell cell, unsigned long spec)
void omtTestDebug(omMemCell cell)
void InitCellAddrContent(omMemCell cell)
void omCheckCells(int n, int level, omMemCell_t *cells)
void TestDup(omMemCell cell, unsigned long spec)
void TestAddrContentEqual(void *s1, void *s2, size_t size)
void omtTestAlloc(omMemCell cell, unsigned long spec)
#define myprintf(format, args...)
void omtTestReallocDebug(omMemCell cell, unsigned long spec)
void omtTestAllocKeep(omMemCell cell, unsigned long spec)
void omtTestDup(omMemCell cell, unsigned long spec)
void omtTestReallocKeep(omMemCell cell, unsigned long spec)
#define DO_FREE_CHECK(spec)
void omtTestAllocDebug(omMemCell cell, unsigned long spec)
void omtTestFreeDebug(omMemCell cell)
void omtTestRealloc(omMemCell cell, unsigned long spec)
void omtTestFree(omMemCell cell)
#define SET_SIZE(spec, size)
void omtTestDupDebug(omMemCell cell, unsigned long spec)
void omtTestFreeKeep(omMemCell cell)
void omtTestDupKeep(omMemCell cell, unsigned long spec)
#define omGetStickyBinOfBin(B)
#define omMergeStickyBinIntoBin(A, B)
#define omPrintUsedAddrs(F, max)
#define omPrintBinStats(F)
#define omInitRet_2_Info(argv0)