Hi All,
I'm trying to get my app to release some memory, as it can grow quite large,
and throw an OutOfMemory exception.

Here is a test example, the code is pretty small, but I'm reading a 35meg
file.

Here's what the code looks like:


   byte[] data = ReadFile( ...); //memory footprint is about 42megs
(taskman), which is acceptable

   chars = Encoding.ASCII.GetChars( data ); //jumps to 115meg --varies a few
meg depending upon the Encoding used.

   data = null; //still stays at 115meg

   GC.Collect();
   GC.WaitForPendingFinalizers();
   GC.Collect();  //memory is still at 115 meg.

Is there any reason why the memory wouldn't have been released after calling
GC.Collect()? I'm assuming calling GC.Collect() would have released the
memory used by data.

Thoughts? Comments?

Thanks,
Dave

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to