No, I'm not, because I need to use the char[] later on.

Cheers!
Dave
----- Original Message -----
From: "Serge Lidin" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, February 03, 2006 4:09 PM
Subject: Re: [ADVANCED-DOTNET] releasing memory


I presume you are doing "chars = null;" as well?

Thanks,
Serge

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of dave wanta
Sent: Friday, February 03, 2006 12:47 PM
To: [email protected]
Subject: [ADVANCED-DOTNET] releasing memory

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(r)  http://www.develop.com

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

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

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

===================================
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