clearing memory from dictionary

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • buu

    #1

    clearing memory from dictionary

    It's strange to me, but, create a dictionary and fill it with 1 mil. of some
    objects.
    then, see the memory consumption (arised, of course).

    then, clean the dictionary.... memory consumption is the same...
    write MyDic=nothing

    memory consumption is still the same
    force GC to collect... memory consumption is little bit smaller

    why?
    how can I release memory prevously kept by dictionary?


  • =?ISO-8859-1?Q?G=F6ran_Andersson?=

    #2
    Re: clearing memory from dictionary

    buu wrote:
    It's strange to me, but, create a dictionary and fill it with 1 mil. of some
    objects.
    then, see the memory consumption (arised, of course).
    >
    then, clean the dictionary.... memory consumption is the same...
    write MyDic=nothing
    >
    memory consumption is still the same
    force GC to collect... memory consumption is little bit smaller
    Forcing a garbage collection rarely has any dramatic effect. If a
    garbage collection is needed, it will be done automatically.
    why?
    how can I release memory prevously kept by dictionary?
    The memory will be released if it's needed for something else.

    What you are seeing is not the amount of memory that is used for active
    objects, you see the amount of memory that is currently allocated for
    the memory heaps in the .NET memory management system. If you want to
    see how much memory is really used, you should use a memory profiler.

    --
    Göran Andersson
    _____
    Göran Anderssons privata hemsida.

    Comment

    Working...