From 7c90c6bb111776fbd75dbc0ebcd361a67a2a9416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 15 Nov 2010 21:48:09 +0000 Subject: [PATCH] * 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 --- src/apps/showimage/ImageCache.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/apps/showimage/ImageCache.cpp b/src/apps/showimage/ImageCache.cpp index fac1410cf0..165ff1ce8b 100644 --- a/src/apps/showimage/ImageCache.cpp +++ b/src/apps/showimage/ImageCache.cpp @@ -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)