From 88c62e21444b624d4f4d6fc3e4ceb2750e1f902d Mon Sep 17 00:00:00 2001 From: mdw Date: Wed, 17 Sep 1997 10:24:47 +0000 Subject: [PATCH] Flush output before and after writing memory tracking information. --- src/utils.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/utils.c b/src/utils.c index 0e0adee..637f29f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: utils.c,v 1.4 1997/09/08 13:43:54 mdw Exp $ + * $Id: utils.c,v 1.5 1997/09/17 10:24:47 mdw Exp $ * * Miscellaneous useful bits of code. * @@ -29,7 +29,10 @@ /*----- Revision history --------------------------------------------------* * * $Log: utils.c,v $ - * Revision 1.4 1997/09/08 13:43:54 mdw + * Revision 1.5 1997/09/17 10:24:47 mdw + * Flush output before and after writing memory tracking information. + * + * Revision 1.4 1997/09/08 13:43:54 mdw * Flush tracedump file after each `interesting' write. * * Revision 1.3 1997/08/20 16:25:37 mdw @@ -369,7 +372,9 @@ void *track_malloc(size_t sz) if (q) { memused += sz; #ifdef TRACK_VERBOSE + fflush(0); printf("[%p] allocated %lu\n", (void *)(q + 1), (unsigned long)sz); + fflush(stdout); #endif q->x.sz = sz; q->x.next = memlist; @@ -399,7 +404,9 @@ void track_free(void *p) return; q = (szblock *)p - 1; #ifdef TRACK_VERBOSE + fflush(0); printf("[%p] freed %lu\n", (void *)(q + 1), (unsigned long)q->x.sz); + fflush(stdout); #endif if (q->x.next) q->x.next->x.prev = q->x.prev; @@ -442,9 +449,11 @@ void *track_realloc(void *p, size_t sz) qq = (realloc)(q, sz + sizeof(szblock)); if (qq) { #ifdef TRACK_VERBOSE + fflush(0); printf("[%p->%p] reallocated %lu -> %lu\n", (void *)(q + 1), (void *)(qq + 1), (unsigned long)osz, (unsigned long)sz); + fflush(stdout); #endif qq->x.sz = sz; qq->x.next = memlist; @@ -486,12 +495,14 @@ unsigned long track_memused(void) void track_memlist(void) { szblock *q = memlist; + fflush(0); printf("listing blocks:\n"); while (q) { printf("... [%p] %lu\n", (void *)(q + 1), (unsigned long)q->x.sz); q = q->x.next; } printf("done\n"); + fflush(stdout); } #endif -- 2.11.0