]> git.llucax.com Git - software/dgc/cdgc.git/commitdiff
Try to keep the memory usage low more aggressively
authorLeandro Lucarella <llucax@gmail.com>
Wed, 15 Sep 2010 01:15:29 +0000 (22:15 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Mon, 20 Sep 2010 23:33:52 +0000 (20:33 -0300)
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

index 11944d8dde11ced157cb9404a0cdfd27f0e4aa4d..9d3164f4de64301a3d51dc94be37ff813cfd5e65 100644 (file)
@@ -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))
             {