 |
My Project
debian-1:4.1.2-p1+ds-2
|
Go to the documentation of this file.
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 * om_AlwaysKeptAddrs
void omtTestFree(omMemCell cell)
void omtTestAllocKeep(omMemCell cell, unsigned long spec)
#define omMemsetW(P1, W, L)
void TestAddrContentEqual(void *s1, void *s2, size_t size)
size_t omSizeOfAddr(const void *addr)
void TestDup(omMemCell cell, unsigned long spec)
#define omInitGetBackTrace()
#define omIsOnGList(ptr, next, addr)
omMemCell_t cells[MAX_CELLS]
void InitCellAddrContent(omMemCell cell)
void omtTestDupDebug(omMemCell cell, unsigned long spec)
#define __omFreeBinAddr(addr)
#define DO_FREE_CHECK(spec)
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
#define omRemoveFromGList(ptr, next, addr)
#define omGetStickyBinOfBin(B)
void TestRealloc(omMemCell cell, unsigned long spec)
void omtTestAllocDebug(omMemCell cell, unsigned long spec)
#define omDebugAddrAlignedBin
#define omPrintUsedAddrs(F, max)
void TestFree(omMemCell cell)
void omCheckCells(int n, int level, omMemCell_t *cells)
void omtTestFreeDebug(omMemCell cell)
#define myprintf(format, args...)
void omtTestDupKeep(omMemCell cell, unsigned long spec)
void omtTestDebug(omMemCell cell)
#define omPrintBinStats(F)
void TestAddrContent(void *addr, unsigned long value, size_t size)
#define SET_SIZE(spec, size)
void omtTestRealloc(omMemCell cell, unsigned long spec)
void omtMergeStickyBins(omMemCell cell, int n)
#define omDebugAddrSize(addr, size)
omBin omtGetStickyBin(omBin bin)
omBinPage_t om_ZeroPage[]
#define omDebugAddrAlignedSize
#define omMergeStickyBinIntoBin(A, B)
void omtTestDup(omMemCell cell, unsigned long spec)
void omtTestFreeKeep(omMemCell cell)
void omtTestReallocKeep(omMemCell cell, unsigned long spec)
#define omFindInGList(ptr, next, what, value)
#define omInitRet_2_Info(argv0)
#define omListLength(ptr)
void omtTestAlloc(omMemCell cell, unsigned long spec)
void omtTestReallocDebug(omMemCell cell, unsigned long spec)
#define omDebugAddrBin(addr, bin)
int main(int argc, char *argv[])
omError_t omTestMemory(int check_level)
void TestAlloc(omMemCell cell, unsigned long spec)