[Mono-list] Mono memory usage 50 times large than python of repeat code, gc bug?

nepneps nepneps at zoho.com
Mon Mar 24 15:54:00 UTC 2014

Today I found a case will cause mono spent very large memory,
basically is define a local int variable "xxx" and call "xxx = int.Parse(xxx.ToString()) + 1;" about 3000 times.

Full code:
c#: http://pastebin.com/a5V3BZJH
python: http://pastebin.com/zKeiYgZ3

Result on my machine:
mono use time (exclude sleep time): 3.57
python use time (exclude sleep time): 0.57
mono use memory: 258.0mb
python use memory: 5.2mb

Mono version:
Mono JIT compiler version 3.2.8 (tarball Sat Mar 22 17:23:10 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

I known python use reference count so it will free the object every times after the object actually not used without waiting collect.
But I don't known how mono work for this, It's a bug or specification?

More information about the Mono-list mailing list