summaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2012-03-19 14:55:30 +0400
committerAndrey Nazarov <skuller@skuller.net>2012-04-03 01:25:48 +0400
commitb615e1afb4d933b2d533126e3d3c286fb31636e9 (patch)
treeb57c9789c00872d8858c87082e35a878c7c1efce /src/common.c
parent5462d7fe9c560e40ffce865d236b9ccdb00d9b11 (diff)
Save allocation time in zhead_t for debugging.
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c
index bece670..cd0d947 100644
--- a/src/common.c
+++ b/src/common.c
@@ -643,6 +643,7 @@ typedef struct zhead_s {
size_t size;
#ifdef _DEBUG
void *addr;
+ time_t time;
#endif
struct zhead_s *prev, *next;
} zhead_t;
@@ -914,6 +915,7 @@ void *Z_TagMalloc(size_t size, memtag_t tag)
#else
z->addr = NULL;
#endif
+ z->time = time(NULL);
#endif
z->next = z_chain.next;
@@ -922,8 +924,7 @@ void *Z_TagMalloc(size_t size, memtag_t tag)
z_chain.next = z;
if (z_perturb && z_perturb->integer) {
- memset(z + 1, z_perturb->integer, size -
- sizeof(zhead_t) - sizeof(uint16_t));
+ memset(z + 1, z_perturb->integer, size - Z_EXTRA);
}
Z_TAIL_F(z) = Z_TAIL;