diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-02-26 22:22:07 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-02-26 22:22:07 +0100 |
commit | 098884981d07ebbb4aabb55aac23c091f18114bb (patch) | |
tree | b4d44d4ecd2994e87aaab0de335f4afe4be4e477 /sys | |
parent | 244d5ab76b6332f55daf6e4df10729b04364429a (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/src/libc/port/pool.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |