Opened 18 years ago
Closed 18 years ago
#1681 closed patch (fixed)
size limit for the OSD image cache
Reported by: | Owned by: | danielk | |
---|---|---|---|
Priority: | minor | Milestone: | 0.20 |
Component: | mythtv | Version: | head |
Severity: | medium | Keywords: | OSD image cache |
Cc: | Ticket locked: | no |
Description
This patch cleans up the implementation of the OSD image cache and introduces a size limit for the in-memory OSD image cache. The implementation is converted to use the Qt's cache structure (QAsciiCache) which provides automatic resizing of the cache when the limit has been reached. The resizing is done by deleting least recently used items (images) from the cache.
The cache is moved as a static class member to OSDTypeImage. Each OSDTypeImage, when finds its image data from cache becomes the owner of the cache item. This is to avoid double frees and freeing of the cache image by the automatism when the image is in use by a OSDTypeImage. When the OSDTypeImage is reinitialized with a new image, the ownership of the old cached image is given back to the cache.
I placed a default size limit of 5 MiB, which seems to allow caching two-three sets of OSD images in memory.
Attached are 0.19-fixes and HEAD patches.
Attachments (4)
Change History (8)
Changed 18 years ago by
Attachment: | osdimagecache-sizelimit-0.19-fixes.diff added |
---|
comment:1 Changed 18 years ago by
The submited patch has a small bug in it: if the source OSD image had underscore in its file name, the detection that checked whether the OSD image file is newer than the cached file failed because the file name reconstructed from the cache key was cut at the underscore position (e.g., 'edit_background.png' -> 'edit').
The updated patches are indentical to the original ones except fixing this bug. For the record, I have been testing this patch for about a week now in the fixes branch and it seems to be stable.
comment:2 Changed 18 years ago by
comment:3 Changed 18 years ago by
Milestone: | → 0.20 |
---|---|
Version: | → head |
0.19-fixes