473,386 Members | 1,785 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,386 software developers and data experts.

Lease expire event

I have a wellknown singleton service object, which accesses unmanaged
resources. It gets the handles to these resources in its constructor. I
want to free these resources when the lease expires (as opposed to at
the time of garbage collection), for two reasons

1. When more requests come, I need to reuse the unmanaged resources,
which I can't until the uncollected instance releases them (i.e. until
finalizer gets called by gc)
2. Why block resources unnecessarily? (This is kind of related to 1).

Now I couldn't find any "lease-expire" event, so two solutions come to
my mind.
1. Get a ridiculously long lease. Problem here is that those resources
remain occupied/blocked until the process terminates.
2. Call GC.Collect(MaxGeneration) in the constructor of the service
object and "hope" that the uncollected instance gets collected. Problem
here is HOPE.

Seems like a simple thing and I hope I'm missing something. Any
suggestions?

Nov 16 '05 #1
0 893

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

Similar topics

1
by: Julia | last post by:
I have a singleton remote object hosted by window service and an ASP.NET client which connect to the remote object though I am returning null from the InitializeLifetimeService() it seems that...
0
by: Julia | last post by:
I have a singleton remote object hosted by window service and an ASP.NET client which connect to the remote object though I am returning null from the InitializeLifetimeService() it seems that...
13
by: Veeresh | last post by:
I am using .Net 1.1. How to expire an .aspx page? I think I have to use HttpCachePolicy class for this. But not sure how to use and where to this code to work. Is it in Page_load event. Thanks...
4
by: Deane | last post by:
Is there a lease time on Web service requests? We have a Web service that stops responding after a couple days. After a certain point in time, all requests to it get "The operation has timed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.