Thread: memory footprint of Dictionary

  1. #1
    Registered User
    Join Date
    May 2006

    memory footprint of Dictionary

    Hello everyone,

    I am migrating from C++ to C#. Two questions about memory footprint of Dictionary class object instance.


    If I call remove method to remove some elements from the Dictionary, will the memory footprint be reduced? (suppose there is no other reference to the removed item) I have some suspecision that Dictionary is not truly removing the element and just mark a flag or something, which still refer this removed item to block it from GCed.


    I have two ideas to reduce memory footprint of Dictionary, one is mentioned in (1), to remove some entries. The other is to create a new Dictionary instance, and insert only necessary items into the new Dictionary instance, and reference only the new Dictionary instance in the future.

    Which way is better from memory footprint reduce perspective?

    thanks in advance,

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    You shouldn't really bother with such details. Trust that the creators of Dictionary did a good implementation, and use it as it should be used. Recreating the Dictionary object sounds like a crazy idea (in a bad sense).

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. available memory from task manager
    By George2 in forum Tech Board
    Replies: 10
    Last Post: 01-18-2008, 02:32 AM
  2. Replies: 4
    Last Post: 01-13-2008, 02:14 AM
  3. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  4. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  5. Shared Memory - shmget questions
    By hendler in forum C Programming
    Replies: 1
    Last Post: 11-29-2005, 02:15 AM