summaryrefslogtreecommitdiff
path: root/lib/mempool.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mempool.c')
-rw-r--r--lib/mempool.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/mempool.c b/lib/mempool.c
index 325b1ecf..5200f5e7 100644
--- a/lib/mempool.c
+++ b/lib/mempool.c
@@ -41,10 +41,8 @@ struct linpool {
uint total, total_large;
};
-_Thread_local linpool *tmp_linpool;
-
static void lp_free(resource *);
-static void lp_dump(resource *);
+static void lp_dump(resource *, unsigned);
static resource *lp_lookup(resource *, unsigned long);
static struct resmem lp_memsize(resource *r);
@@ -233,9 +231,9 @@ lp_restore(linpool *m, lp_state *p)
struct lp_chunk *c;
/* Move ptr to the saved pos and free all newer large chunks */
- m->current = c = p->current;
- m->ptr = p->ptr;
- m->end = c ? c->data + LP_DATA_SIZE : NULL;
+ m->current = c = p->current ?: m->first;
+ m->ptr = p->ptr ?: (c ? c->data : NULL);
+ m->end = c ? (c->data + LP_DATA_SIZE) : NULL;
m->total_large = p->total_large;
while ((c = m->first_large) && (c != p->large))
@@ -264,11 +262,12 @@ lp_free(resource *r)
}
static void
-lp_dump(resource *r)
+lp_dump(resource *r, unsigned indent)
{
linpool *m = (linpool *) r;
struct lp_chunk *c;
int cnt, cntl;
+ char x[32];
for(cnt=0, c=m->first; c; c=c->next, cnt++)
;
@@ -279,6 +278,14 @@ lp_dump(resource *r)
cntl,
m->total,
m->total_large);
+
+ bsprintf(x, "%%%dschunk %%p\n", indent + 2);
+ for (c=m->first; c; c=c->next)
+ debug(x, "", c);
+
+ bsprintf(x, "%%%dslarge %%p\n", indent + 2);
+ for (c=m->first_large; c; c=c->next)
+ debug(x, "", c);
}
static struct resmem