From 119cb085fadb55adf71bd20f2ca30056bc99991f Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 5 Dec 2019 16:35:23 -0800 Subject: [PATCH] evas: reduce useless allocation during destruction of image. Evas image use a GC to reduce duplicated state accross multiple object. Still during shutdown we do clean it up and free it. There is no point to push that down the GC if we are to just free it after. Relying on the fact that dynamic content will avoid triggering the GC altogether as their content change to frequently and is expected to be uniq among other objects, we can avoid unecessary allocation during the destruction by just switching that early on during the destructor. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10815 --- src/lib/evas/canvas/evas_object_image.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 4653aff177..192c4285d5 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -1677,10 +1677,13 @@ evas_object_image_init(Evas_Object *eo_obj) } EOLIAN static void -_efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o EINA_UNUSED) +_efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); + // To avoid unecessary GC storage triggered during shutdown, we mark the content as dynamic + o->content_hint = EFL_GFX_IMAGE_CONTENT_HINT_DYNAMIC; + if (obj->legacy.ctor) evas_object_image_video_surface_set(eo_obj, NULL); efl_gfx_image_stretch_region_set(eo_obj, NULL, NULL);