Re: Relieving memory pressure
Re: Relieving memory pressure
- Subject: Re: Relieving memory pressure
- From: Steve Christensen via Cocoa-dev <email@hidden>
- Date: Sun, 7 Jun 2020 13:15:59 -0700
For slide shows that I’ve seen, they typically display each image for several
seconds at a time. If that’s the case, why can’t you just load the next image
from disk on a background queue while the current image is being displayed and
not have to worry about memory usage needed to cache multiple images? (I am
assuming that you’ll need to load each image once anyway.)
If caching is required—apologies if I missed the “why” in earlier comments—then
have you looked at NSCache? From the docs:
The NSCache class incorporates various auto-eviction policies, which ensure
that a cache doesn’t use too much of the system’s memory. If memory is needed
by other applications, these policies remove some items from the cache,
minimizing its memory footprint.
> On Jun 7, 2020, at 5:31 AM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> Good question.
>
> Well, some users want to feed my app with image files of 100 MB, even up to
> 400 MB (mostly jpeg compressed).
> Those images have resolutions of over 8k, sometimes over 10k.
>
> The slideshow app needs to be able to zoom into those images with at least a
> factor 2x scaling.
>
> So I figured that if someone has a 4k monitor, creating thumbnails with 8k
> resolution maximum should be sufficient.
>
> An 8k x 8k image needs at least 200 MB (1 byte per channel).
> I don't know how CGImage stores the uncompressed images internally,
> but my experience seems to indicate that it uses significantly more memory
> than that.
> (maybe it uses two bytes per channel, or even floats, or there is some other
> aux data)
>
>> What do you need a 1GB thumbnail for? There is no screen that can display
>> that. For a slideshow app you could scale your thumbnails at creation time
>> to the users biggest screen pixel size, don’t you think?
>>
>> Christos Konidaris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden