chiark
/
gitweb
/
~mdw
/
become
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d8cd61f
)
Flush output before and after writing memory tracking information.
author
mdw
<mdw>
Wed, 17 Sep 1997 10:24:47 +0000
(10:24 +0000)
committer
mdw
<mdw>
Wed, 17 Sep 1997 10:24:47 +0000
(10:24 +0000)
src/utils.c
patch
|
blob
|
blame
|
history
diff --git
a/src/utils.c
b/src/utils.c
index 0e0adee597e004ae89f0c45928272c1fcee1e8c6..637f29f74927d70f6004553173885e3e7fd833c8 100644
(file)
--- a/
src/utils.c
+++ b/
src/utils.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-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.
*
*
* Miscellaneous useful bits of code.
*
@@
-29,7
+29,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: utils.c,v $
/*----- 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
* 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
if (q) {
memused += sz;
#ifdef TRACK_VERBOSE
+ fflush(0);
printf("[%p] allocated %lu\n", (void *)(q + 1), (unsigned long)sz);
printf("[%p] allocated %lu\n", (void *)(q + 1), (unsigned long)sz);
+ fflush(stdout);
#endif
q->x.sz = sz;
q->x.next = memlist;
#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
return;
q = (szblock *)p - 1;
#ifdef TRACK_VERBOSE
+ fflush(0);
printf("[%p] freed %lu\n", (void *)(q + 1), (unsigned long)q->x.sz);
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;
#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
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);
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;
#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;
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");
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
}
#endif