473,796 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creation and destruction objects

Hi to all,

I would like to know how .net manage the objects and what are the cicle of life of the objects...
Are the same this cicle, for the objects created in windows applications and for the web applications?

Any help will be grateful
Thank
Owatona

Nov 15 '05 #1
3 1702
An object lives as long as there exists any references to it.
The garbage collector will every so often check all objects to see if they
are still referenced, and if not, release it and any other objects this
object references.

For web application things are slightly different.
The lifespan is still basically the same, but your "form" will terminate
once it is made and sent to the user, and the "applicatio n" will terminate
when there is no session holding it alive. Objects references will
therefore end and the objects will be released. You can store objects as
Session or Application variables to use accross pages and sessions.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode and Nostalgia enabled
Nov 15 '05 #2
Hi owatona,

The lifetime of objects in NET apps is managed by the .NET
garbage collector. Please try this link - It gives a good
overview of the garbage collector.
http://www.msdnaa.net/Resources/Display.aspx?ResID=601

Regards,
Aravind C

"owatona" <an*******@disc ussions.microso ft.com> wrote in message
news:26******** *************** ***********@mic rosoft.com...
Hi to all,

I would like to know how .net manage the objects and what are the cicle of life of the objects... Are the same this cicle, for the objects created in windows applications and for the web applications??
Any help will be grateful.
Thanks
Owatona.

Nov 15 '05 #3
Morten.... To be clear, an object is also eligible for garbage
collection
when is is unreachable, so two isolated objects can hold references to
each other (circular references) and still be marked for garbage
collection.

Regards,
Jeff
An object lives as long as there exists any references to it.<

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4

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

Similar topics

7
5657
by: Richard | last post by:
Hi all, I am looking for some help on understanding the overhead associated with object creation in Java. I am writing an application where I have written a class to encapsulate some text data. The class is contains these private variables:
0
1237
by: Stephan Keil | last post by:
Hi all, consider a class class X { static X& OneX() { static X sgl1; return sgl1; } static X& TheX() { static X sgl2(OneX()); return sgl2; } }; and two source files with global variables
14
1672
by: Jim Langston | last post by:
Which is more efficient (if either) MyHugeClass MyObject; for ( int i = 0; i < 1000; ++i ) { MyObject = SomeVal; Use MyObject; }
35
2184
by: Maxim Yegorushkin | last post by:
The following code: #include <iostream> class base { private: virtual ~base() { std::cout << "virtual ~base()\n";
6
1203
by: Charles Law | last post by:
As a matter of practice, where would people put the following elements of object creation/initialisation: Create shared member objects Initialise shared member objects Create non-shared member objects Initialise non-shared member objects Initialise peripherals The places where these could take place would appear to be
9
3007
by: plahey | last post by:
I have been dabbling in Python for a while now. One of the things that really appeals to me is that I can seem to be able to use C++-style RAII idioms to deal with resource management issues. For those that have no idea what I am talking about (I learn a lot reading posts on subjects in which I am clueless), consider the following code snippet: for line in file(name): ...print line,
5
1448
by: Parapura Rajkumar | last post by:
hey all class A { }; class B {
5
1287
by: cctv.star | last post by:
I need to maintain certain data structure, shared by all instances of a class, declared as . This data structure must change whenever a new object is created or an existing object is destroyed. So I declared a static field with attribute. Now I need to add some code into all places where objects are created and destroyed. This class has 2 ctors: one default, and another taking parameters. I've found out, to my surprise, that new...
31
3419
by: Tom P. | last post by:
I am doing quite a bit of custom painting and it means I have to create a lot of brushes (think one for every file system object in a directory) per paint. How expensive is this? Should I find a way to create the brushes once, store them in an member variable, and use them when I need them? Or is creating brushes a throw-away process that doesn't take a lot of work? Thanks for the info. Tom P.
0
9525
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
10221
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
10169
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
10003
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...
0
9050
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...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.