summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index fe9459f..d228d8f 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -494,6 +494,12 @@ malloc_uninit(data)
{
struct malloc_type *type = (struct malloc_type *)data;
struct malloc_type *t;
+ struct kmembuckets *kbp;
+ struct freelist *freep;
+ long indx;
+#ifdef INVARIANTS
+ int s;
+#endif
if (type->ks_magic != M_MAGIC)
panic("malloc type lacks magic");
@@ -504,6 +510,24 @@ malloc_uninit(data)
if (type->ks_limit == 0)
panic("malloc_uninit on uninitialized type");
+#ifdef INVARIANTS
+ s = splmem();
+ for (indx = 0; indx < MINBUCKET + 16; indx++) {
+ kbp = bucket + indx;
+ freep = (struct freelist*)kbp->kb_next;
+ while (freep) {
+ if (freep->type == type)
+ freep->type = M_FREE;
+ freep = (struct freelist*)freep->next;
+ }
+ }
+ splx(s);
+
+ if (type->ks_memuse != 0)
+ printf("malloc_uninit: %ld bytes of '%s' still allocated\n",
+ type->ks_memuse, type->ks_shortdesc);
+#endif
+
if (type == kmemstatistics)
kmemstatistics = type->ks_next;
else {
OpenPOWER on IntegriCloud