473,623 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(in dex);
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@(s pam)hotmail.com
-> Suprimir (spam)
Nov 16 '05 #1
1 1877
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
2691
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 deperation because when I defined it as char * insert(char table,int cols, char values)
6
2761
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 GOES HERE -->
4
1161
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 = 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??
4
36527
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 or delete keyword to do so. Also I don't want to wait for the GC to be called.
64
3400
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 pointers. Can someone please explain why? thanks. Zytan
21
2797
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 defined as 24 float **gvoiceSpat; float **notechannelGain;
5
1730
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 but have only dabbled in C++. To The Point. If i declare a variable ready for use as a dynamic array int* ArrayName; and initialize it so it has a size of 1 ArrayName=new int ;
127
4851
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
1060
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 " & i Next Do have I have set Test = Nothing to prevent a memory leak?
1
1087
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
8165
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8670
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8613
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8326
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8469
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4164
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1778
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.