473,413 Members | 2,056 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,413 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)
Nov 16 '05 #1
1 1785
Hi Andrés,

I assume you are using an ArrayList and RemoveAt(int index) as arrays are very different and do not have a remove method.

1: The objects removed from the list may be referenced elsewhere, in which case they won't be garbage collected until all references are ended.

2: The garbage collector will not clear the objects right away so there may be a time delay before they are destroyed. If you have a lot of memory it may decide that it's better that you have a fast program and delay clearing the objects until you end your program or memory runs low.

Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2

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...
6
by: Fernando Cacciola | last post by:
Help me out here please: While watching Brad Abraham's MSDN TV talk about the Dispose pattern, refering to: public virtual void Dispose ( bool disposing ) { if ( disposing ) { <-- WHAT...
4
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: 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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.