By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

Arrays and freeing memory

P: n/a
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)
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

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

Ken
------------------
".:: MaStErDoN ::." <an**********@SPAMhotmail.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
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)

Nov 20 '05 #2

P: n/a
Hi Ken,
Add these two lines of code.
array=nothing
GC.collect

Are you sure of this?

Cor
Nov 20 '05 #3

P: n/a

".:: MaStErDoN ::." <an**********@SPAMhotmail.com> 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
Nov 20 '05 #4

P: n/a
* ".:: MaStErDoN ::." <an**********@SPAMhotmail.com> 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/>
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.