* 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:
parent
332e24fb43
commit
14438ad555
9
src/system/kernel/cache/block_cache.cpp
vendored
9
src/system/kernel/cache/block_cache.cpp
vendored
@ -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;
|
||||
}
|
||||
@ -1004,8 +1009,8 @@ dump_cache(int argc, char **argv)
|
||||
count++;
|
||||
}
|
||||
|
||||
kprintf(" %ld blocks total, %ld dirty, %ld referenced.\n", count, dirty,
|
||||
referenced);
|
||||
kprintf(" %ld blocks total, %ld dirty, %ld referenced, %ld in unused.\n", count, dirty,
|
||||
referenced, cache->unused_blocks.Size());
|
||||
|
||||
hash_close(cache->hash, &iterator, false);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user