[nem-bug] [Nemerle 0000611]: heap class does not recover memory when its no longer used

feedback at nemerle.org feedback at nemerle.org
Mon May 22 18:06:11 CEST 2006


The following issue has been CLOSED
======================================================================
<http://nemerle.org/bugs/view.php?id=611> 
======================================================================
Reported By:                user317
Assigned To:                nazgul
======================================================================
Project:                    Nemerle
Issue ID:                   611
Category:                   The Standard Library
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Resolution:                 not an issue
Fixed in Version:           
======================================================================
Date Submitted:             02-03-2006 22:30 CET
Last Modified:              05-22-2006 18:06 CEST
======================================================================
Summary:                    heap class does not recover memory when its no
longer used
Description: 
I am not sure if its a bug in mono, but the following code takes up about
200mb of  memory, even after the heap is no longer used.  
======================================================================

----------------------------------------------------------------------
 user317 - 02-04-06 02:30 
----------------------------------------------------------------------
similar problem with a list, although it looks like it does recover some
memory, since it doesnt grow as much as it would if it didn't.  Rand also
breaks after 3mil accesses.  

using Nemerle.Collections;
using Nemerle.Collections.List;
using Nemerle.IO;
using Nemerle.Text;
using System;
using System.IO;

def test(times) {
   mutable ll = [];
   mutable time = DateTime.Now;
   for(mutable ii = 0; ii<times; ii++) {
      ll = ii::ll;
      when(ii%100000 == 0) {
         print("$((DateTime.Now - time).TotalSeconds) \n");
         time = DateTime.Now;
      }
   }
   ll = [];
   GC.Collect();
}
test(10000000);
test(10000000);
test(10000000);
test(10000000);
test(10000000);
test(10000000);
test(10000000);
test(10000000);
test(10);
print("done\n");
GC.Collect();
while(true) {
   System.Threading.Thread.Sleep(100);
}

----------------------------------------------------------------------
 malekith - 02-04-06 08:58 
----------------------------------------------------------------------
Both samples work just right under MS.NET 2.0. The memory after everything
is done is about 20M.

There are some things you should know about the current mono GC:
- it's conservative, which means it can sometimes fail to release the
memory if there is something that ,,looks'' like a pointer to that memory
- it generally doesn't release memory once acquired (it should reuse it
though)
- they are working on a new precise GC

----------------------------------------------------------------------
 nazgul - 02-19-06 21:02 
----------------------------------------------------------------------
These are the specifics of mono runtime. Let's hope they will introduce
better GC soon.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
02-03-06 22:30 user317        New Issue                                    
02-04-06 02:30 user317        Note Added: 0001069                          
02-04-06 08:58 malekith       Note Added: 0001070                          
02-19-06 21:02 nazgul         Status                   new => resolved     
02-19-06 21:02 nazgul         Resolution               open => not an issue
02-19-06 21:02 nazgul         Assigned To               => nazgul          
02-19-06 21:02 nazgul         Note Added: 0001096                          
02-19-06 21:02 nazgul         Additional Information Updated                    
05-22-06 18:06 nazgul         Status                   resolved => closed  
======================================================================




More information about the bugs mailing list