4 #define OM_CHECK CHECK_LEVEL
15 #if defined (__hpux) || defined (__alpha) || defined (__svr4__) || defined (__SVR4)
17 #if defined (__hpux) || defined (__svr4__) || defined (__SVR4)
26 static void srandom(
long seed)
40 if (cell->bin !=
NULL)
56 if (!OM_IS_ALIGNED(cell->addr))
59 "addr:%p is unaligned", cell->addr);
63 if (
IS_ALIGNED(cell->spec) && !OM_IS_STRICT_ALIGNED(cell->addr))
66 "addr:%p is not strict unaligned", cell->addr);
71 if (!OM_IS_ALIGNED(is_size))
74 "is_size == %u is unaligned", is_size);
80 "is_size==%u < size==%u", is_size, size);
87 "is_sizeW==%u < sizeW==%u", is_size >> LOG_SIZEOF_LONG,
omSizeWOfAddr(cell->addr));
97 size_t sizeW = OM_ALIGN_SIZE(size) >> LOG_SIZEOF_LONG;
99 for (i=0; i<sizeW; i++)
101 if (((
unsigned long*)s1)[i] != ((
unsigned long*)s2)[i])
104 "s1[%u]==%d != s2[%u]==%d", i, ((
unsigned long*)s1)[i], i, ((
unsigned long*)s2)[i]);
112 size_t sizeW = OM_ALIGN_SIZE(size) >> LOG_SIZEOF_LONG;
115 if (!OM_IS_ALIGNED(addr))
118 "addr %p unaligned", addr);
122 for (i=0; i<sizeW; i++)
124 if (((
unsigned long*)addr)[i] != value)
127 "word %d modified: is %u should be %u", i, ((
unsigned long*)addr)[i], value);
142 #if END_CHECK_LEVEL > 0
156 if ((i % 10000) == 0)
172 unsigned long spec = random() + 1;
258 if (cell->addr !=
NULL)
282 if (sticky_bin ==
NULL)
294 if (cell[i].orig_bin !=
NULL)
299 cell[
i].bin = cell[
i].orig_bin;
300 cell[
i].orig_bin =
NULL;
309 omBin next_bin = bin->next;
324 printf(
"\nomtTest Summary: ");
340 int main(
int argc,
char* argv[])
342 int i=0, error_test = 1;
343 unsigned long spec,
j;
347 int last_kept_freed = 0;
358 if (argc > 1) sscanf(argv[1],
"%d", &error_test);
359 if (argc > 2) sscanf(argv[2],
"%d", &
seed);
362 if (argc > 3) sscanf(argv[3],
"%d", &n);
363 if (argc > 4) sscanf(argv[4],
"%d", &decr);
365 if (decr < 2) decr = 2;
366 printf(
"seed == %d\n",
seed);
373 printf(
"\nCells: %d KeptAddr:%d AlwaysKeptAddr:%d\n", n_cells,
381 printf(
"Checking Memory and all cells ");
389 #if CHECK_LEVEL > 0 && TRACK_LEVEL > 0
390 if (error_test &&
errors == 0)
409 if (
om_Info.CurrentRegionsAlloc > 0)
417 if (n <= 0 || n_cells <= 100)
423 n_cells = n_cells / decr;
471 printf(
"%d:", i / 1000);
478 if ((i % 10000) == 0 && i != n_cells && i!=last_kept_freed)
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
#define omRemoveFromGList(ptr, next, addr)
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
void omPrintInfo(FILE *fd)
void omtTestReallocDebug(omMemCell cell, unsigned long spec)
void omtTestAllocDebug(omMemCell cell, unsigned long spec)
void omtTestAllocKeep(omMemCell cell, unsigned long spec)
int main(int argc, char *argv[])
void TestAddrContentEqual(void *s1, void *s2, size_t size)
size_t omSizeOfAddr(const void *addr)
#define omInitGetBackTrace()
void TestDup(omMemCell cell, unsigned long spec)
#define DO_FREE_CHECK(spec)
void omPrintBinStats(FILE *fd)
void omInitRet_2_Info(const char *argv0)
void TestRealloc(omMemCell cell, unsigned long spec)
void InitCellAddrContent(omMemCell cell)
const CanonicalForm CFMap CFMap int &both_non_zero int n
#define omDebugAddrSize(addr, size)
void omtTestDupDebug(omMemCell cell, unsigned long spec)
size_t omSizeWOfAddr(void *addr)
void TestFree(omMemCell cell)
#define omDebugAddrAlignedBin
#define omListLength(ptr)
#define omDebugAddrAlignedSize
void omPrintStats(FILE *fd)
void omCheckCells(int n, int level, omMemCell_t *cells)
omBinPage_t om_ZeroPage[]
void omtTestDupKeep(omMemCell cell, unsigned long spec)
omError_t omTestMemory(int check_level)
#define myprintf(format, args...)
void TestAddrContent(void *addr, unsigned long value, size_t size)
void omtTestRealloc(omMemCell cell, unsigned long spec)
void omtTestFreeDebug(omMemCell cell)
void omtMergeStickyBins(omMemCell cell, int n)
void omtTestDebug(omMemCell cell)
omBin omGetStickyBinOfBin(omBin bin)
omBin omtGetStickyBin(omBin bin)
void omtTestReallocKeep(omMemCell cell, unsigned long spec)
#define omMemsetW(P1, W, L)
#define __omFreeBinAddr(addr)
#define SET_SIZE(spec, size)
void omtTestFreeKeep(omMemCell cell)
void TestAlloc(omMemCell cell, unsigned long spec)
void * om_AlwaysKeptAddrs
void omPrintUsedAddrs(FILE *fd, int max_frames)
void omtTestAlloc(omMemCell cell, unsigned long spec)
#define omFindInGList(ptr, next, what, value)
#define omDebugAddrBin(addr, bin)
void omtTestFree(omMemCell cell)
void omtTestDup(omMemCell cell, unsigned long spec)
#define omIsOnGList(ptr, next, addr)
omMemCell_t cells[MAX_CELLS]