473,396 Members | 2,009 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,396 software developers and data experts.

Garbage collection in .net

Hello,

I am using singleton class in my application. I want that the
singleton class object onc created should be alive as long as the appliation
is running.
But when I try running my application after say 24 hours, it doesn't work. I
think the object is being killed at some instance of time. Is there any
object life time for singleton objects. i.e. the object gets garbage
collected if not accessed for long amount of time even if we have reference
to that object. If so, how to avoid it?

Thanks,
Reshma
Nov 17 '05 #1
3 2665

"Reshma Prabhu" <re***********@persistent.co.in> wrote in message
news:eB**************@TK2MSFTNGP15.phx.gbl...
Hello,

I am using singleton class in my application. I want that the
singleton class object onc created should be alive as long as the
appliation is running.
But when I try running my application after say 24 hours, it doesn't work.
I think the object is being killed at some instance of time. Is there any
object life time for singleton objects. i.e. the object gets garbage
collected if not accessed for long amount of time even if we have
reference to that object. If so, how to avoid it?


No, an object will only be collected if unreferenced. Are you sure that the
singleton is being collected? Are you using ASP.NET or winforms? Can you
provide an error message or stack trace at the failure point(preferably with
associated code)?
Nov 17 '05 #2
I am using ASP.Net? No error comes but the application re-creates the
object.

Thanks,
Reshma
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:OZ*************@TK2MSFTNGP15.phx.gbl...

"Reshma Prabhu" <re***********@persistent.co.in> wrote in message
news:eB**************@TK2MSFTNGP15.phx.gbl...
Hello,

I am using singleton class in my application. I want that the
singleton class object onc created should be alive as long as the
appliation is running.
But when I try running my application after say 24 hours, it doesn't
work. I think the object is being killed at some instance of time. Is
there any object life time for singleton objects. i.e. the object gets
garbage collected if not accessed for long amount of time even if we have
reference to that object. If so, how to avoid it?


No, an object will only be collected if unreferenced. Are you sure that
the singleton is being collected? Are you using ASP.NET or winforms? Can
you provide an error message or stack trace at the failure
point(preferably with associated code)?

Nov 17 '05 #3

"Reshma Prabhu" <re***********@persistent.co.in> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
I am using ASP.Net? No error comes but the application re-creates the
object.

Thanks,
Reshma


The singleton lifecycle is tied to the containing application domain, when
this one gets recycled your singleton will recycle too. Asp.net might
recycle application domains when certain conditions are met, like memory
threshold, deadlocks no response timeouts etc. You can check this by looking
at the ASP.NET perfcounters (Application restarts I guess).

Willy.

Nov 17 '05 #4

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

Similar topics

1
by: Bob | last post by:
Are there any known applications out there used to test the performance of the .NET garbage collector over a long period of time? Basically I need an application that creates objects, uses them, and...
6
by: Ganesh | last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a process without have access to the process code. regards Ganesh
11
by: Rick | last post by:
Hi, My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind...
34
by: Ville Voipio | last post by:
I would need to make some high-reliability software running on Linux in an embedded system. Performance (or lack of it) is not an issue, reliability is. The piece of software is rather simple,...
5
by: Bob lazarchik | last post by:
Hello: We are considering developing a time critical system in C#. Our tool used in Semiconductor production and we need to be able to take meaurements at precise 10.0 ms intervals( 1000...
8
by: mike2036 | last post by:
For some reason it appears that garbage collection is releasing an object that I'm still using. The object is declared in a module and instantiated within a class that is in turn instantiated by...
28
by: Goalie_Ca | last post by:
I have been reading (or at least googling) about the potential addition of optional garbage collection to C++0x. There are numerous myths and whatnot with very little detailed information. Will...
56
by: Johnny E. Jensen | last post by:
Hellow I'am not sure what to think about the Garbage Collector. I have a Class OutlookObject, It have two private variables. Private Microsoft.Office.Interop.Outlook.Application _Application =...
350
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use...
158
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is...
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:
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.