raster pushed a commit to branch enlightenment-0.21. http://git.enlightenment.org/core/enlightenment.git/commit/?id=a9d73c89ed9a13e54ce94d82ea397017fe9f9def
commit a9d73c89ed9a13e54ce94d82ea397017fe9f9def Author: Carsten Haitzler (Rasterman) <[email protected]> Date: Tue Jul 26 13:27:56 2016 +0900 e - fix major memory bloat when in gl mode - dont create shm segments so e pixmap was ALWAYS creating an ecore_x_image EVERY time for EVERY window. this means allocate all the sysv shared memory segments for every window even if never used. this is bad. it litters systems with unused shared memory segments (ipcs and see) and eats up shared mem limits/quotas too. we just don't need them in gl unless a window is shaped or texture from pixmap is off. so allocate the pixmap on demand, and otherwise leave the ecore x image NULL. this fixes this bloat. @fix --- src/bin/e_pixmap.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index febb689..921cc06 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -830,12 +830,7 @@ e_pixmap_image_refresh(E_Pixmap *cp) { case E_PIXMAP_TYPE_X: #ifndef HAVE_WAYLAND_ONLY - if (cp->image) return EINA_TRUE; - if ((!cp->visual) || (!cp->client->depth)) return EINA_FALSE; - cp->image = ecore_x_image_new(cp->w, cp->h, cp->visual, cp->client->depth); - if (cp->image) - cp->image_argb = ecore_x_image_is_argb32_get(cp->image); - return !!cp->image; + return EINA_TRUE; #endif break; case E_PIXMAP_TYPE_WL: @@ -904,6 +899,20 @@ e_pixmap_image_is_argb(const E_Pixmap *cp) return EINA_FALSE; } +static Eina_Bool +_e_pixmap_image_alloc(E_Pixmap *cp) +{ + if (cp->image) return EINA_TRUE; + if ((!cp->visual) || (!cp->client->depth)) return EINA_FALSE; + cp->image = ecore_x_image_new(cp->w, cp->h, cp->visual, cp->client->depth); + if (cp->image) + { + cp->image_argb = ecore_x_image_is_argb32_get(cp->image); + return EINA_TRUE; + } + return EINA_FALSE; +} + E_API void * e_pixmap_image_data_get(E_Pixmap *cp) { @@ -913,7 +922,7 @@ e_pixmap_image_data_get(E_Pixmap *cp) { case E_PIXMAP_TYPE_X: #ifndef HAVE_WAYLAND_ONLY - if (cp->image) + if (_e_pixmap_image_alloc(cp)) return ecore_x_image_data_get(cp->image, &cp->ibpl, NULL, &cp->ibpp); #endif break; @@ -964,7 +973,8 @@ e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r) { case E_PIXMAP_TYPE_X: #ifndef HAVE_WAYLAND_ONLY - if ((!cp->image) || (!cp->pixmap)) return EINA_FALSE; + if (!cp->pixmap) return EINA_FALSE; + if (!_e_pixmap_image_alloc(cp)) return EINA_FALSE; return ecore_x_image_get(cp->image, cp->pixmap, r->x, r->y, r->x, r->y, r->w, r->h); #endif break; --
