ref: 098884981d07ebbb4aabb55aac23c091f18114bb
parent: 244d5ab76b6332f55daf6e4df10729b04364429a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Feb 26 17:22:07 EST 2015
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.
--- a/sys/src/libc/port/pool.c
+++ b/sys/src/libc/port/pool.c
@@ -627,9 +627,11 @@
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 @@
* 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 @@
*u++ = ALIGN_MAGIC;
}
trim(p, b, skip+dsize);
+ p->curalloc += b->size;
assert(D2B(p, c) == b);
antagonism {
memset(c, 0xDD, dsize);