* write_cached_block() now moves a block to the unused list when it's
not referenced and clean (is no longer part of a transaction). This finally gets memory consumption to a moderate level; even unpacking a large archive will no longer eat all memory. * The "block_cache" KDL command will now print the number of unused blocks as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24606 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+7
-2
@@ -861,6 +861,11 @@ write_cached_block(block_cache *cache, cached_block *block,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (block->transaction == NULL && block->ref_count == 0) {
|
||||||
|
// the block is no longer used
|
||||||
|
block->unused = true;
|
||||||
|
cache->unused_blocks.Add(block);
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -1004,8 +1009,8 @@ dump_cache(int argc, char **argv)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
kprintf(" %ld blocks total, %ld dirty, %ld referenced.\n", count, dirty,
|
kprintf(" %ld blocks total, %ld dirty, %ld referenced, %ld in unused.\n", count, dirty,
|
||||||
referenced);
|
referenced, cache->unused_blocks.Size());
|
||||||
|
|
||||||
hash_close(cache->hash, &iterator, false);
|
hash_close(cache->hash, &iterator, false);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user