[Mono-list] Why mono GC does not realloc the heap after collect?
Petit Eric
surfzoid at gmail.com
Tue Nov 3 13:59:17 EST 2009
rarrrr, forget the monolist, sorry
2009/11/3 Petit Eric <surfzoid at gmail.com>
> same if trying to force :
> //Example code
> //On the NetFarmework - all work fine
>
> //On Mono - ~105MiB in the heap, after GC.Collect(). Expected ~5 MiB
> ////////////////
> using System;
> using System.Collections.Generic;
> using System.Text;
>
> namespace mono_gc_test
> {
> class Program
> {
> static object alloc100MB()
> {
> byte[] data = new byte[100 * 1024 * 1024];
> return data;
> }
> static void msg(string text, bool wait)
> {
> Console.WriteLine(text);
> if (wait)
> Console.ReadLine();
> }
> static void Main(string[] args)
> {
> object data = null;
> msg("Mono GC.Collect() realloc test.", false);
> msg(GC.GetTotalMemory(true).ToString(),false);
>
> msg("Press ENTER to alloc 100MiB of data", true);
> data = alloc100MB();
> msg(GC.GetTotalMemory(true).ToString(),false);
>
> msg("Press ENTER to GC.Collect()", true);
> data = null;
> GC.Collect();
>
> msg(GC.GetTotalMemory(true).ToString(),false);
> GC.Collect(100 * 1024 *
> 1024,GCCollectionMode.Forced);
> msg(GC.GetTotalMemory(true).ToString(),false);
> msg("Press ENTER to exit", true);
> }
> }
> }
>
> 2009/11/3 Alex A Ermoshenko <erax at rambler.ru>
>
>
>> //Example code
>> //On the NetFarmewort - all work fine
>> //On Mono - ~105MiB in the heap, after GC.Collect(). Expected ~5 MiB
>> ////////////////
>> using System;
>> using System.Collections.Generic;
>> using System.Text;
>>
>> namespace mono_gc_test
>> {
>> class Program
>> {
>> static object alloc100MB()
>> {
>> byte[] data = new byte[100 * 1024 * 1024];
>> return data;
>> }
>> static void msg(string text, bool wait)
>> {
>> Console.WriteLine(text);
>> if (wait)
>> Console.ReadLine();
>> }
>> static void Main(string[] args)
>> {
>> object data = null;
>> msg("Mono GC.Collect() realloc test.", false);
>> msg("Press ENTER to alloc 100MiB of data", true);
>> data = alloc100MB();
>> msg("Press ENTER to GC.Collect()", true);
>> data = null;
>> GC.Collect();
>> msg("Press ENTER to exit", true);
>> }
>> }
>> }
>> --
>> View this message in context:
>> http://old.nabble.com/Why-mono-GC-does-not-realloc-the-heap-after-collect--tp26160496p26160496.html
>> Sent from the Mono - General mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Mono-list maillist - Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>
>
>
> --
> Cordially.
>
> Small Eric Quotations of the days:
> ---------------------------------------------------------------------------
>
> I have no special talents. I am only passionately curious
>
--
Cordially.
Small Eric Quotations of the days:
---------------------------------------------------------------------------
I have no special talents. I am only passionately curious
Sent from Bordeaux, France
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20091103/8062f73a/attachment.html
More information about the Mono-list
mailing list