This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+ if (!malloc_check) {
+ /* Linux libc malloc check */
+ setenv("MALLOC_CHECK_", "2", 1);
+
+ /* NetBSD malloc check */
+ setenv("MALLOC_OPTIONS", "AJ", 1);
+
+ malloc_check = TRUE;
+ }
+
for (s = stack; s; s = s->next) {
if (s->file == stack->file && s->line == stack->line &&
s->depth == stack->depth &&
for (s = stack; s; s = s->next) {
if (s->file == stack->file && s->line == stack->line &&
s->depth == stack->depth &&
fprintf(fp, "<stacktrace>%s:%d: #blocks=%lu, bytes=%lu\n",
stack->file, stack->line, blocks, bytes);
for (i = 0; i < stack->depth; i++)
fprintf(fp, "<stacktrace>%s:%d: #blocks=%lu, bytes=%lu\n",
stack->file, stack->line, blocks, bytes);
for (i = 0; i < stack->depth; i++)
"-----------------------------------------\n"
"-----------------------------------------\n"
" Memory leaks dumped to 'stacktrace.log'\n"
"-----------------------------------------\n"
"-----------------------------------------\n"
" Memory leaks dumped to 'stacktrace.log'\n"