473,797 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Destructors...


Hi folks,

Given the nature of asp, when I'm constructing data bound middler tier
objects, is it necessary to implement the Idisposable interface or is it
good enough to rely on a Finalize call.

Most of my applications will be using Forms authentication and as such the
sql server connection objects will all have individual user id's i.e. no
connection pooling, and because of the time between posts, I can't see any
reason not rely on the normal garbage collection.

Any comments would be much appreciated...

Thanks...P

P.S Since when did the Oxford English Dictionary spell Finalise with a Z??
Bloomin' nuisance.
Nov 18 '05 #1
2 1056
Regarding pooling: unless you explicitly turn off pooling in your connection
string, then you will end up with connection pooling with a default number
of 100 connections. If you are using the connections in such a way that you
can't re-use them, then this pool will diminish even faster. This could
cause problems as your user base expands.

Regarding IDisposable: Unless you need to hold in the state of your object
some scarce resources, then you have no reason to expose this interface
yourself. You should, however, make a point to properly use this interface
in the objects you are using that expose this interface. If you are using
C#, you can use the using keyword to make this easy. For example:

using (SqlConnection myConnection = new SqlConnection(. ..)) {
// do something with the connection
}

Using functions in much the same way as a try ... finally clause would,
guaranteeing to call Dispose as soon as you are done using the connection,
either releasing it to the pool or else returning those resources to the
system. With scare resources, you should make it a point to free them up as
soon as you have the opportunity to do so. Because garbage collection is
non-deterministic, you could run out of your scarce resources long before
you run out of the resources that trigger garbage collection.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Paul M" <ma****@trials. bham.ac.uk> wrote in message
news:ew******** ******@TK2MSFTN GP10.phx.gbl...

Hi folks,

Given the nature of asp, when I'm constructing data bound middler tier
objects, is it necessary to implement the Idisposable interface or is it
good enough to rely on a Finalize call.

Most of my applications will be using Forms authentication and as such the
sql server connection objects will all have individual user id's i.e. no
connection pooling, and because of the time between posts, I can't see any
reason not rely on the normal garbage collection.

Any comments would be much appreciated...

Thanks...P

P.S Since when did the Oxford English Dictionary spell Finalise with a Z??
Bloomin' nuisance.

Nov 18 '05 #2
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Paul M" <ma****@trials. bham.ac.uk> wrote in message
news:ew******** ******@TK2MSFTN GP10.phx.gbl...

Hi folks,

Given the nature of asp, when I'm constructing data bound middler tier
objects, is it necessary to implement the Idisposable interface or is it
good enough to rely on a Finalize call.

Most of my applications will be using Forms authentication and as such the
sql server connection objects will all have individual user id's i.e. no
connection pooling, and because of the time between posts, I can't see any
reason not rely on the normal garbage collection.

Any comments would be much appreciated...

Thanks...P

P.S Since when did the Oxford English Dictionary spell Finalise with a Z??
Bloomin' nuisance.

Nov 18 '05 #3

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

Similar topics

3
21394
by: Rajesh Garg | last post by:
Can we have private constructors and destructors? IF yes what is the use of such constructors or destructors.....in the sense where can these be implemented in a system................. I have an idea that we can have private constructors and destructors but am not able to find a situation where they can be used... Regards RVG rajeshgarg@opussoft.com
3
2720
by: Nuno Barros | last post by:
Cn someone tell me if when i call the destructor of a derivated class, the destructor of the base class is called implicitly? Or shall i call the destructor by myself? Thanks in advance Nuno Barros
12
1819
by: Ross Boylan | last post by:
I am trying to understand under what circumstances destructors get called with std::vector. I have an application in which I will put real objects, not just pointers, in the vector. 1. The standard says that empty() has constant complexity. If it actually called the destructor for each object, it seems to me it would have linear complexity. Does empty() call the destructor for each object in the container? If yes, why is it described...
8
1430
by: johny smith | last post by:
If I have a simple class with say a couple of integers only is there any need for me to provide a destructor? thanks!
7
1891
by: qazmlp | last post by:
When a member function is declared as virtual in the base class, the derived class versions of it are always treated as virtual. I am just wondering, why the same concept was not used for the destructors. What I am expecting is, if the destructor is declared as virtual in base, the destructors of all its derived classes also should be virtual always. What exactly is the reason for not having it so?
26
2729
by: Michi Henning | last post by:
I've been having problem with destructors in the context of having ported C# code developed under .NET to Mono. What happens is that, on a dual-CPU machine, various parts of the code crash randomly (and rarely). This always happens during process shutdown, after some thread has called System.Environment.Exit(). Clearly, some sort of race condition. Note that what follows only applies to destructors that are called when the process shuts...
8
1807
by: Edward Diener | last post by:
I have a __value class which uses some legacy C++ code. So I wrapped the legacy C++ code in another __nogc class and have a pointer to that class as a member of my __value class. When the __value class is created, I dynamically allocate an object of the class with the legacy C++ code. However because the __value class has no destructor, I can never release that allocated memory. Why does a __value class allow no destructor ? Without it I...
3
1898
by: alex.gman | last post by:
If I have code like this int f() { // ... stuff ... g(); if(x > 0) return (x+4); // ... more stuff ... always_call(z); return y; }
6
7533
by: mlw | last post by:
Could someone explain why there is no destructor in Java classes? There are many times you need to be called WHEN an object goes out of scope and not when it will eventally be freed.
6
5168
by: Jeff Newman | last post by:
Hello, Could anyone explain to me why the following class's destructor shows up as having multiple branches? (At least as judged by gcov 4.1.2 when compiled with gcc 4.1.2 ): struct blah { blah(); virtual ~blah();
0
9685
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
10468
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
10245
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...
0
10021
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
9063
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
6802
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
5458
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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4131
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

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.