How much memory (RAM) should this take?

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

How much memory would you expect an arraylist with 100,000 items (all
strings with about 7 characters per string) to take? I'm seeing about 8-12
MB on my emulator. Is that too high? Is there any way that I can bring
that down?

Thanks,

-Dave
 
You can measure it easily. Try something like this:

long start = GC.GetTotalMemory(false);

ArrayList al = new ArrayList();
for(int i = 0; i < 100000; i++)
{
al.Add(i.ToString("0000000"));
}

MessageBox.Show((GC.GetTotalMemory(false) - start).ToString());

BTW, Daniel is right you should review your requirements and avoid
storing so large ArrayList in memory.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
Back
Top