summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Popov <bp@FreeBSD.org>2000-07-07 14:15:20 +0000
committerBoris Popov <bp@FreeBSD.org>2000-07-07 14:15:20 +0000
commitc72e366670c1eb037a5c6e33dc7da09c49396fc1 (patch)
treef5cdd1ee1fc4f2fcc3ddcc54671eb320dec76e9d
parent384f95dcd9a2053ecd6cd5bed601fbca06232cf9 (diff)
Notes
-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 95685925027c..a7801e08e0a4 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -507,6 +507,12 @@ malloc_uninit(data)
{
struct malloc_type *type = (struct malloc_type *)data;
struct malloc_type *t;
+#ifdef INVARIANTS
+ struct kmembuckets *kbp;
+ struct freelist *freep;
+ long indx;
+ int s;
+#endif
if (type->ks_magic != M_MAGIC)
panic("malloc type lacks magic");
@@ -517,6 +523,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 {