evas_image_main: make the cache->usage count eina_file size
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 26 Oct 2018 10:16:32 +0000 (19:16 +0900)
committerYeongjong Lee <yj34.lee@samsung.com>
Thu, 8 Nov 2018 06:40:47 +0000 (15:40 +0900)
Summary:
The image.data is set to null by evas_common_rgba_image_unload_real.
After this point the cache->usage does not count cache_entry.w and h value when
evas_gl_common_image_free calls evas_cache_image_flush.
So the cache->usage increases just around 300. If the cache->limit is 4194304,
then the cache could have around 1398 items. This would be fine.

But each items hold eina_file, and the cache does not count eina_file size.
If the file size is 326352, then a process could use 456527385 bytes.

So this patch set make the cache->usage count eina_file size.
This would be better option than https://phab.enlightenment.org/D7029

Reviewers: Hermet, jypark, cedric

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7030

src/lib/evas/common/evas_image_main.c

index 012cb96..0b2a12f 100644 (file)
@@ -841,6 +841,7 @@ _evas_common_rgba_image_ram_usage(Image_Entry *ie)
    if (ie->cache_key) size += strlen(ie->cache_key);
    if (ie->file) size += strlen(ie->file);
    if (ie->key) size += strlen(ie->key);
+   if (ie->f && eina_file_virtual(ie->f)) size += eina_file_size_get(ie->f);
 
    if (im->image.data)
      {