all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#51354: [PATCH] Fix a memory leak in pgtk_draw_fringe_bitmap
@ 2021-10-23 14:34 Sharaf Zaman
       [not found] ` <87zgqzda7w.fsf@sdf.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sharaf Zaman @ 2021-10-23 14:34 UTC (permalink / raw)
  To: 51354

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]


Hello!

I discovered that there's a memory leak in the pgtk code, if the windows are
created/destroyed/moved/shrunk/widened frequently. I've verified it with
profiler that this indeed is the location (https://i.imgur.com/LnrgGyj.png) and
fixed it (https://i.imgur.com/zdgnn5K.png).

PS: This is my first time sending a patch, I'm not 100% sure if this is
how it's done.

--
Kind Regards,
Sharaf Zaman

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-a-memory-leak-in-pgtk_draw_fringe_bitmap.patch --]
[-- Type: text/x-patch, Size: 1032 bytes --]

From 13a901f5e1d6b262ea08e05e95d3e69f99ad4e13 Mon Sep 17 00:00:00 2001
From: Sharaf Zaman <shzam@sdf.org>
Date: Sat, 23 Oct 2021 14:01:55 +0000
Subject: [PATCH] Fix a memory leak in pgtk_draw_fringe_bitmap

* src/pgtkterm.c (pgtk_draw_fringe_bitmap): we had an unbalanced
cairo_save/restore.
---
 src/pgtkterm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 86074d010d..40489c0c6b 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -3504,7 +3504,6 @@ pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
   struct face *face = p->face;
 
   cairo_t *cr = pgtk_begin_cr_clip (f);
-  cairo_save (cr);
 
   /* Must clip because of partially visible lines.  */
   pgtk_clip_to_row (w, row, ANY_AREA, cr);
@@ -3546,7 +3545,7 @@ pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
 			  p->wd, p->h, p->x, p->y, p->overlay_p);
     }
 
-  cairo_restore (cr);
+  pgtk_end_cr_clip(f);
 }
 
 static struct atimer *hourglass_atimer = NULL;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-25 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23 14:34 bug#51354: [PATCH] Fix a memory leak in pgtk_draw_fringe_bitmap Sharaf Zaman
     [not found] ` <87zgqzda7w.fsf@sdf.org>
2021-10-23 15:41   ` bug#51355: Fwd: " Sharaf Zaman
2021-10-24 18:09     ` bug#51354: " Lars Ingebrigtsen
     [not found]       ` <874k95txyd.fsf@sdf.org>
2021-10-25 13:35         ` bug#51355: " Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.