473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Arrays and freeing memory

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
4 1141
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
Hi Ken,
Add these two lines of code.
array=nothing
GC.collect

Are you sure of this?

Cor
Nov 20 '05 #3

".:: 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
* ".:: 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ruben | last post by:
I'm trying to pass an array of string to a function without knowing how many strings I have beforehand. I've defined one functions as char * insert(char table,int cols, char values); out of...
1
by: .:: MaStErDoN ::. | last post by:
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 =...
4
by: Atul Sureka | last post by:
Hi, I want to free the object memory in C# - like we do using 'delete' keyword in C++. Lets say I have an object of some class and I want to explicitly free the memory. C# do not have any free...
64
by: Zytan | last post by:
I know there are no pointers in C#, but if you do: a = b; and a and b are both arrays, they now both point to the same memory (changing one changes the other). So, it makes them seem like...
21
by: ico.bukvic | last post by:
Hi all, I've made a 2d dynamic array as follows (this is a snippet so not all variables are accounted for): //numvoices are dynamic (1-1000), entered by user //MAXCHANNELS is currently...
5
Delerna
by: Delerna | last post by:
Been playing around with DirectX 10 in C++ and I have been using arrays to store info for vertex buffers. To simplify my question I will drop DX10 from the equation. I am an experienced programmer...
127
by: sanjay.vasudevan | last post by:
Why are the following declarations invalid in C? int f(); int f(); It would be great if anyone could also explain the design decision for such a language restricton. Regards, Sanjay
1
by: headware | last post by:
Do you have to manually release memory allocated by creating a dynamic array using ReDim? In other words, if I have the following code: ReDim Test(1000) For i = 0 To 1000 Test(i) = "test value...
1
by: lancer6238 | last post by:
Hi all, I have problems freeing up the memory that has been reallocated. My code is as follows: #include <stdio.h> #include <stdlib.h> int main() {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.