From 680e7a382f9ea03568aceaf71f3fbb8ced83f76c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 6 Oct 2020 08:18:42 +0100 Subject: 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. --- grid.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'grid.c') 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. */ -- cgit