For the bundled modules this could hide useful error messages.
https://rt.cpan.org/Ticket/Display.html?id=75560
+ - IM_DEBUG_MALLOC mymalloc() no longer sn?printfs() a string to a
+ buffer in the array of allocations, but just stores the filename
+ pointer and line number.
+ https://rt.cpan.org/Ticket/Display.html?id=70388
+
Imager 0.88 - 22 Feb 2012
===========
typedef struct {
void* ptr;
size_t size;
- char comm[MAXDESC];
+ const char *file;
+ int line;
} malloc_entry;
malloc_entry malloc_pointers[MAXMAL];
buf += UNDRRNVAL;
malloc_pointers[i].ptr = buf;
malloc_pointers[i].size = size;
-#ifdef IMAGER_SNPRINTF
- snprintf(malloc_pointers[i].comm, sizeof(malloc_pointers[i].comm),
- "%s (%d)", file, line);
-#else
- sprintf(malloc_pointers[i].comm,"%s (%d)", file, line);
-#endif
+ malloc_pointers[i].file = file;
+ malloc_pointers[i].line = line;
return buf;
}
mm_log((0,"malloc_state()\n"));
bndcheck_all();
for(i=0; i<MAXMAL; i++) if (malloc_pointers[i].ptr != NULL) {
- mm_log((0,"%d: %lu (%p) : %s\n", i, (unsigned long)malloc_pointers[i].size, malloc_pointers[i].ptr, malloc_pointers[i].comm));
+ mm_log((0,"%d: %lu (%p) : %s (%d)\n", i, (unsigned long)malloc_pointers[i].size, malloc_pointers[i].ptr, malloc_pointers[i].file, malloc_pointers[i].line));
total += malloc_pointers[i].size;
}
if (total == 0) mm_log((0,"No memory currently used!\n"))
return;
for(i=0; i<MAXMAL; i++) if (malloc_pointers[i].ptr == p) {
- mm_log((1,"myfree_file_line: pointer %i (%s) freed at %s (%i)\n", i, malloc_pointers[i].comm, file, line));
+ mm_log((1,"myfree_file_line: pointer %i (%s (%d)) freed at %s (%i)\n", i, malloc_pointers[i].file, malloc_pointers[i].line, file, line));
bndcheck(i);
malloc_pointers[i].ptr = NULL;
match++;