* Do not precache anymore if we're low on memory anyway.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39442 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-11-15 21:48:09 +00:00
parent 1d219b3a25
commit 7c90c6bb11
1 changed files with 7 additions and 0 deletions

View File

@ -95,6 +95,13 @@ ImageCache::RetrieveImage(const entry_ref& ref, int32 page,
QueueEntry* entry;
if (findQueue == fQueueMap.end()) {
if (target == NULL && fCacheMap.size() < 5
&& fBytes > fMaxBytes * 1 / 2) {
// Don't accept any further precaching if we're low on memory
// anyway.
return B_NO_MEMORY;
}
// Push new entry to the queue
entry = new(std::nothrow) QueueEntry();
if (entry == NULL)