473,946 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to destroy array

Hi,

I have created an array of Objects in a collection. I was wondering is there
a way to destroy the array to free up the space in the memory ? or they are
automatically destroyed and garbagge collected by .Net framework?

Sarfraz
Nov 16 '05 #1
2 7070
Sarfraz Hooda <sh****@iqueri. com> wrote:
I have created an array of Objects in a collection. I was wondering is there
a way to destroy the array to free up the space in the memory ? or they are
automatically destroyed and garbagge collected by .Net framework?


When the array is no longer referenced (or is only referenced by things
eligible for garbage collection) it will become eligible for garbage
collection.

The references inside the array will become eligible for garbage
collection when the array does if and only if there are no other
references to them (which aren't themselves eligible for garbage
collection).

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
In addition, if you remove the items from the array using Remove(),
RemoveAt(), or Clear(), then the items are eligeable for garbage collection
as well. But again, this applies, if and only if, there are no other
references to the items.

Pete

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Sarfraz Hooda <sh****@iqueri. com> wrote:
I have created an array of Objects in a collection. I was wondering is there a way to destroy the array to free up the space in the memory ? or they are automatically destroyed and garbagge collected by .Net framework?


When the array is no longer referenced (or is only referenced by things
eligible for garbage collection) it will become eligible for garbage
collection.

The references inside the array will become eligible for garbage
collection when the array does if and only if there are no other
references to them (which aren't themselves eligible for garbage
collection).

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3481
by: Bob Bedford | last post by:
I've this code I've included in ALL my pages: session_cache_limiter('private, must-revalidate'); if(!session_is_registered("ID")){ if(!session_id()) session_start(); $UserID = 0; if (isset($_SESSION) and $_SESSION > 0){ showmessage($_SESSION); $UserID = $_SESSION;
3
6522
by: Derek Fountain | last post by:
The documentation says session_destroy() "destroys all of the data associated with the current session". Um, like what? The docs further say that you should remove all information in the _SESSION global with $_SESSION = array() and you should use setcookie() to set the session cookie to a blank value. Having done those, what does that leave session_destroy() to do? The page at http://au2.php.net/manual/en/function.session-destroy.php...
2
26292
by: Rob | last post by:
My first GUI so be gentle... When I start my program I call a class that runs the initial window. While in this class if a certain button is pressed it calls a function outside the class. This function then initially calls another function to "root.destroy()". Basically I want the current window gone so the function I just called can open it's own window. The problem I'm stuck with is that once this function is done and I need to close...
6
18026
by: max(01)* | last post by:
hi people. when i create a widget, such as a toplevel window, and then i destroy it, how can i test that it has been destroyed? the problem is that even after it has been destroyed, the instance still exists and has a tkinter name, so testing for None is not feasible: >>> import Tkinter >>> fin = None >>> fin1 = Tkinter.Toplevel()
43
2743
by: Sarfraz Hooda | last post by:
Hi, I have created an array of Objects in a collection. I was wondering is there a way to destroy the array to free up the space in the memory ? or they are automatically destroyed and garbagge collected by .Net framework? Sarfraz
8
1958
by: vvenk | last post by:
Hello: I just wrote my first ASP.Net application. It worked fine on my machine and when I put into production, the ASP.Net process reaches 50% quite fast and then the system does not work anymore until I kill that process. Obviously, this is not acceptable. Looking back, I do not destroy any objects in my form. Would that be the reasn why the application breaks down?
15
4654
by: Mark C | last post by:
I know a string is immutable, but is there any trick or any other way to destroy a string Thanks www.quiznetonline.com
10
7480
by: Horacius ReX | last post by:
Hi, in some C program I need to port to some architecture, I send to a function the parameter char with predefined values. Inside the function, this data is read and something is calculated. But for some reasons that I can not explain here (too long) the memory is really small and I would need to use the space used by this char. Then I wonder if it can be deleted or destroyed in some way. Afterwards I need to use malloc and free and I...
3
6534
by: drzoo2 | last post by:
Completely noob question as I am not a programmer but really trying hard to learn Python (Object oriented programming in general). I am writing a program in python that calls a popup window with some general information with an ok button. If I close the window using the window's close button I have no problems but If I call the same destroy function using the button call, it will not kill the popup. def destroy(self, widget, data=None):...
0
10149
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9974
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
11549
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
11140
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
11320
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
9872
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8240
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
6095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3524
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.