* If there are no free ranges left, the block cache will now reuse older
blocks - this is not enough, though as it would also need to ask other volumes to free ranges. * Increased the number of blocks to free in case of low memory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16663 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+13
-4
@@ -218,8 +218,17 @@ block_cache::GetFreeRange()
|
|||||||
// we need to allocate a new range
|
// we need to allocate a new range
|
||||||
block_range *range;
|
block_range *range;
|
||||||
if (block_range::New(this, &range) != B_OK) {
|
if (block_range::New(this, &range) != B_OK) {
|
||||||
// ToDo: free up space in existing ranges
|
RemoveUnusedBlocks(2, 50);
|
||||||
// We may also need to free ranges from other caches to get a free one
|
|
||||||
|
if (!free_ranges.IsEmpty())
|
||||||
|
return free_ranges.First();
|
||||||
|
|
||||||
|
RemoveUnusedBlocks(LONG_MAX, 50);
|
||||||
|
|
||||||
|
if (!free_ranges.IsEmpty())
|
||||||
|
return free_ranges.First();
|
||||||
|
|
||||||
|
// TODO: We also need to free ranges from other caches to get a free one
|
||||||
// (if not, an active volume might have stolen all free ranges already)
|
// (if not, an active volume might have stolen all free ranges already)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -377,11 +386,11 @@ block_cache::LowMemoryHandler(void *data, int32 level)
|
|||||||
case B_NO_LOW_MEMORY:
|
case B_NO_LOW_MEMORY:
|
||||||
return;
|
return;
|
||||||
case B_LOW_MEMORY_NOTE:
|
case B_LOW_MEMORY_NOTE:
|
||||||
free = 10;
|
free = 50;
|
||||||
accessed = 2;
|
accessed = 2;
|
||||||
break;
|
break;
|
||||||
case B_LOW_MEMORY_WARNING:
|
case B_LOW_MEMORY_WARNING:
|
||||||
free = 50;
|
free = 200;
|
||||||
accessed = 10;
|
accessed = 10;
|
||||||
break;
|
break;
|
||||||
case B_LOW_MEMORY_CRITICAL:
|
case B_LOW_MEMORY_CRITICAL:
|
||||||
|
|||||||
Reference in New Issue
Block a user