24 fprintf(stderr,
"%s", errorStr);
28int main(
int argc,
char *argv[])
51 fprintf(stderr,
"\n*** Simple memory test\n|\n");
61 int blocksize = 10000;
64 printf(
"|--* Allocating block %d\n", i);
66 sprintf(tagstring,
"Memblock no. %d : ", i);
80 fprintf(stderr,
"|--* Memory test FAILED\n|\n");
83 fprintf(stderr,
"|--* Memory tested as good (as it should be)\n|\n");
98 int blocksize = 10000;
101 printf(
"|--* Allocating block %d\n", i);
103 sprintf(tagstring,
"Memblock no. %d : ", i);
108 ip = (
int *)p[5] - 50;
109 for (i = 0; i < 1000; i++, ip++) {
118 error_status |= !retval;
121 fprintf(stderr,
"|--* Memory test failed (as it should be)\n");
124 fprintf(stderr,
"|--* Memory test FAILED to find corrupted blocks \n");
133 fprintf(stderr,
"|--* Memory was corrupted\n");
138 fprintf(stderr,
"|\n|--* Errors were detected\n");
141 fprintf(stderr,
"|\n|--* Test exited successfully\n");
144 fprintf(stderr,
"|\n*** Finished test\n\n");
Read Guarded memory(de)allocation.
void(* MEM_set_error_callback)(void(*func)(const char *))
void MEM_freeN(void *vmemh)
bool(* MEM_consistency_check)(void)
void *(* MEM_callocN)(size_t len, const char *str)
void(* MEM_printmemlist)(void)
static void mem_error_cb(const char *errorStr)