malloc_trim is itself very poor and gets slower and slower as the heap becomes

more fragmented. Run it only once an hour. GitHub issue 2551.
This commit is contained in:
Nicholas Marriott 2021-03-11 08:39:41 +00:00
parent 12cfd0d22b
commit ef9700816f
2 changed files with 4 additions and 3 deletions

3
grid.c
View File

@ -265,9 +265,6 @@ 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. */

View File

@ -159,6 +159,10 @@ server_tidy_event(__unused int fd, __unused short events, __unused void *data)
format_tidy_jobs();
#ifdef HAVE_MALLOC_TRIM
malloc_trim(0);
#endif
log_debug("%s: took %llu milliseconds", __func__, get_timer() - t);
evtimer_add(&server_ev_tidy, &tv);
}