473,473 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create 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 1048
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**************@TK2MSFTNGP10.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**************@TK2MSFTNGP10.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
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...
3
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 ...
12
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...
8
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
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...
26
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...
8
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...
3
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
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
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 {...
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
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.