PC Review


Reply
Thread Tools Rate Thread

Arrays and freeing memory

 
 
.:: MaStErDoN ::.
Guest
Posts: n/a
 
      17th May 2004
Hi!
I'm working with arrays, saving on them information about files. All works
fine but the problem is that when i finish using them and i remove all the
information using:
for index = array.count to 0 step -1
array.remove(index);
next
i check the task manager and my program is still using 32 mb!!
Is there any way to free memory when i finish using the arrays??

Thanks!

--
Andrés Iraolagoitía
andresiraola@(spam)hotmail.com
-> Suprimir (spam)

--
Andrés Iraolagoitía
andresiraola@(spam)hotmail.com
-> Suprimir (spam)


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      17th May 2004
Hi,

Add these two lines of code.
array=nothing
GC.collect

Ken
------------------
".:: MaStErDoN ::." <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi!
> I'm working with arrays, saving on them information about files. All works
> fine but the problem is that when i finish using them and i remove all the
> information using:
> for index = array.count to 0 step -1
> array.remove(index);
> next
> i check the task manager and my program is still using 32 mb!!
> Is there any way to free memory when i finish using the arrays??
>
> Thanks!
>
> --
> Andrés Iraolagoitía
> andresiraola@(spam)hotmail.com
> -> Suprimir (spam)
>
> --
> Andrés Iraolagoitía
> andresiraola@(spam)hotmail.com
> -> Suprimir (spam)
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      17th May 2004
Hi Ken,
> Add these two lines of code.
> array=nothing
> GC.collect
>

Are you sure of this?

Cor


 
Reply With Quote
 
Larry Serflaten
Guest
Posts: n/a
 
      17th May 2004

".:: MaStErDoN ::." <(E-Mail Removed)> wrote
> Hi!
> I'm working with arrays, saving on them information about files. All works
> fine but the problem is that when i finish using them and i remove all the
> information using:
> for index = array.count to 0 step -1
> array.remove(index);
> next
> i check the task manager and my program is still using 32 mb!!
> Is there any way to free memory when i finish using the arrays??



Have you tried using Erase?

LFS
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      17th May 2004
* ".:: MaStErDoN ::." <(E-Mail Removed)> scripsit:
> I'm working with arrays, saving on them information about files. All works
> fine but the problem is that when i finish using them and i remove all the
> information using:
> for index = array.count to 0 step -1
> array.remove(index);
> next
> i check the task manager and my program is still using 32 mb!!
> Is there any way to free memory when i finish using the arrays??


You /don't/ need to remove the items if the array variable runs out of
scope. Memory usage as shown by the task manager doesn't have much to
do with how much memory your .NET application really needs. The GC will
free memory "by need".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Freeing Dynamic Arrays headware Microsoft ASP .NET 1 14th May 2008 09:18 PM
Freeing memory =?Utf-8?B?N25pbmphNw==?= Windows XP Performance 4 25th Sep 2007 01:12 PM
FREEING MEMORY =?Utf-8?B?SEVMUA==?= Windows XP General 5 31st Aug 2006 01:03 AM
FREEING UP SPACE?? REPLY 2 freeing up memory below =?Utf-8?B?QU5EWQ==?= Windows XP General 5 15th Sep 2005 02:39 PM
Arrays and freeing memory .:: MaStErDoN ::. Microsoft C# .NET 1 17th May 2004 07:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:56 AM.