Groups | Blog | Home
all groups > vb.net > may 2004 >

vb.net : Arrays and freeing memory


Ken Tucker [MVP]
5/16/2004 9:54:22 PM
Hi,

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

Ken
------------------
[quoted text, click to view]

.:: MaStErDoN ::.
5/16/2004 10:48:44 PM
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)

Larry Serflaten
5/17/2004 2:01:36 AM

[quoted text, click to view]


Have you tried using Erase?

Cor Ligthert
5/17/2004 7:28:55 AM
Hi Ken,
[quoted text, click to view]
Are you sure of this?

Cor

hirf-spam-me-here NO[at]SPAM gmx.at
5/17/2004 10:45:39 AM
* ".:: MaStErDoN ::." <andresiraola@SPAMhotmail.com> scripsit:
[quoted text, click to view]

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]
AddThis Social Bookmark Button