From fcae2848ff5191cadae251c0a1c5ce3ea66a02b8 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 14 Sep 2010 22:15:29 -0300 Subject: [PATCH 1/1] Try to keep the memory usage low more aggressively Memory usage is minimize()d only when a big allocation is done. This could be problematic for applications that only perform small objects allocation, as their memory usage could grow a lot, specially if the eager allocation option is used. Trigger memory minimization even for small objects allocation to avoid that pathological case. --- rt/gc/cdgc/gc.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rt/gc/cdgc/gc.d b/rt/gc/cdgc/gc.d index 11944d8..9d3164f 100644 --- a/rt/gc/cdgc/gc.d +++ b/rt/gc/cdgc/gc.d @@ -416,6 +416,9 @@ void minimize() if (gc.mark_proc_pid != 0) return; + if (gc.pools.length == 0) + return; + size_t n; size_t pn; Pool* pool; @@ -1312,6 +1315,7 @@ private void *malloc(size_t size, uint attrs, size_t* pm_bitmask) { //newPool(1); } + minimize(); } if (!gc.free_list[bin] && !allocPage(bin)) { -- 2.43.0