summaryrefslogtreecommitdiffstats
path: root/grid.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2020-10-06 08:18:42 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2020-10-06 08:18:42 +0100
commit680e7a382f9ea03568aceaf71f3fbb8ced83f76c (patch)
tree8cacca7d0d2888c85816a261499256b74559d90b /grid.c
parent847a061e31ceab5c94519fe25104e16de6a92f8d (diff)
glibc's malloc is very bad about returning memory from the kernel, add a call
to its malloc_trim to prompt it to do so. Reported by Sarunas Valaskevicius.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/grid.c b/grid.c
index 96302fc3..90e1a0a5 100644
--- a/grid.c
+++ b/grid.c
@@ -265,6 +265,9 @@ grid_free_lines(struct grid *gd, u_int py, u_int ny)
for (yy = py; yy < py + ny; yy++)
grid_free_line(gd, yy);
+#ifdef HAVE_MALLOC_TRIM
+ malloc_trim(0);
+#endif
}
/* Create a new grid. */