From 098884981d07ebbb4aabb55aac23c091f18114bb Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 26 Feb 2015 22:22:07 +0100 Subject: pool: maintain Pool.curalloc for poolallocalign() and blockgrow() blockgrow() and poolallocalign() change the size of allocated blocks which needs to be accounted for in Pool.curalloc. --- sys/src/libc/port/pool.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/src/libc') diff --git a/sys/src/libc/port/pool.c b/sys/src/libc/port/pool.c index ddd223634..201215aa9 100644 --- a/sys/src/libc/port/pool.c +++ b/sys/src/libc/port/pool.c @@ -627,9 +627,11 @@ blockgrow(Pool *p, Bhdr *b, ulong nsize) ulong dsize; a = (Alloc*)b; + p->curalloc -= a->size; dsize = getdsize(a); blocksetsize(a, nsize); trim(p, a, dsize); + p->curalloc += a->size; } } @@ -1119,6 +1121,7 @@ poolallocalignl(Pool *p, ulong dsize, ulong align, long offset, ulong span) * or mark it as unavailable. */ b = _D2B(v); + p->curalloc -= b->size; b = freefromfront(p, b, skip); v = _B2D(b); skip = c - (char*)v; @@ -1128,6 +1131,7 @@ poolallocalignl(Pool *p, ulong dsize, ulong align, long offset, ulong span) *u++ = ALIGN_MAGIC; } trim(p, b, skip+dsize); + p->curalloc += b->size; assert(D2B(p, c) == b); antagonism { memset(c, 0xDD, dsize); -- cgit v1.2.3