473,699 Members | 2,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another (prolly silly) upgrade query

Hi all

in my VB6 project, every function had a tidyup section at the end
(approximates to the "finally" contsruct in a try..catch block).

It did a SET OBJECT=NOTHING, for explicit memory release.

In .NET, is this totally redundant, and I'm best off letting the compiler
handle things ?

Thanks
Nov 20 '05 #1
4 919
Hi Jethro,
in my VB6 project, every function had a tidyup section at the end
(approximates to the "finally" contsruct in a try..catch block).

It did a SET OBJECT=NOTHING, for explicit memory release.

In .NET, is this totally redundant, and I'm best off letting the compiler
handle things ?


Yes, however it is more the framework that handles this for you.

However closing on the right moment is something that can be very important
in dotNet.

(And there are some things that needs to be disposed. Think for that by
instance on bitmaps and connections when it is for a network with more than
100 connections to the database).

Cor


Nov 20 '05 #2
"Jethro" <Je*******@hotm ail.com> schrieb
Hi all

in my VB6 project, every function had a tidyup section at the end
(approximates to the "finally" contsruct in a try..catch block).

It did a SET OBJECT=NOTHING, for explicit memory release.
This was already superfluous in VB6 at the end of a function.
In .NET, is this totally redundant, and I'm best off letting the
compiler handle things ?


What should the compiler do?
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
* "Jethro" <Je*******@hotm ail.com> scripsit:
in my VB6 project, every function had a tidyup section at the end
(approximates to the "finally" contsruct in a try..catch block).

It did a SET OBJECT=NOTHING, for explicit memory release.
You didn't have to do that if the variable ran out of scope.
In .NET, is this totally redundant, and I'm best off letting the compiler
handle things ?


In 99 percent of the cases, you don't need that, if the variable runs
out of scope or if you are assigning another reference to it. In many
cases, setting a variable to 'Nothing' is contra-productive.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:2g******** ***@uni-berlin.de...
* "Jethro" <Je*******@hotm ail.com> scripsit:
in my VB6 project, every function had a tidyup section at the end
(approximates to the "finally" contsruct in a try..catch block).

It did a SET OBJECT=NOTHING, for explicit memory release.
You didn't have to do that if the variable ran out of scope.


It's a habit I was taught by the gurus where I used to work ... they had
memories of Win16 programming, and memory leaks, and made it a rule to
always explicitly release the reference ... they also sniffed at "Dim myObj
as new ..." and claimed that it should be "Dim myObj as thisClass/Set
myObj=New myClass" ....
In .NET, is this totally redundant, and I'm best off letting the compiler handle things ?


In 99 percent of the cases, you don't need that, if the variable runs
out of scope or if you are assigning another reference to it. In many
cases, setting a variable to 'Nothing' is contra-productive.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>



Nov 20 '05 #5

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

Similar topics

14
7950
by: Ruth | last post by:
Hi All I am not a DBA, but a unix administrator. After our DBA's upgraded from oracle 8.0.5 to oracle 8.1.7.4 on our test server, we have noticed a big slow down in our application (acocobol). From ~10mins to ~45mins. Server info:
7
6659
by: Abdul-Wahid Paterson | last post by:
Hi, I have had a site working for the last 2 years and have had no problems until at the weekend I replace my database server with a newer one. The database migration went like a dream and I had the whole db changed over in 1 hour. Since the upgrade I have been getting the following error message sporadically.
2
14920
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data in the format that I need it in order to create the reports that we use. So far this has proven to be successful for the reports that I am doing and the data that I am pulling into it. I just have one challenge that may require a lot of work and I...
2
9468
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of the choice made in the first drop-down list? If so, how can that be done? I am working with 'Teach Yourself Microsoft Access' and I didn't see it discussed in that book (if it's even possible to do). Or would I just have to create linked tables...
7
1267
by: Gavin M. Roy | last post by:
I upgraded my main production db from 7.3.4 last night to 7.4.1. I'm running into an issue where a big query that may take 30-40 seconds to reply is holding up all other backends from performing their queries. Once the big query is finished, all the tiny ones fly through. This is seemingly ne behavior on the box, as with previous versions things would slow down, but not wait for the cpu/resource hog queries to finish. The box is...
3
2783
by: RayPower | last post by:
I'm having a system using Access 2000 as both front-end (queries, forms, reports & temp tables for reports) & back-end (data) with back-end running on the server. The application runs on the network with around 15 users. The back-end database is suffering from performance issues. There were several corruptions since few months & one major corruption & corrupted the MSysObjects table. Also, the system will run batch process that generate...
0
1553
by: Yellowfin pty ltd | last post by:
Announcing Yellowfin Version 2.5 upgrade release. (www.yellowfin.com.au) Existing DB2 based users can take advantage of this upgrade as soon as convenient. Downloads are available through the customer portal. V2.5 The changes in this release significantly enhance our BI and
3
1306
by: Nemisis | last post by:
Hi everyone, i have currently got a classic asp web application and am wanting to upgrade it to asp.net 2.0, and also take advantage of OOP. Our current application is not using OOP so you can imagine how hard it is too upgrade. I have read documentation all over the net, but still have some questions (if anyone has any good documentation, i would love to read it!!). i should warn you the questions maybe stupid/easy but i just need...
3
2605
by: rfuscjr via AccessMonster.com | last post by:
This is truly bizzare. I have a query that runs for hours in one Access db. When I import it into another Access db, it runs in minutes. I compacted and repaired the original, relinked tables etc. Nothing makes it run faster. I have imported the query in several dbs. I did find another where it appeared to run very long. Still in others it runs in minutes. Ideas? -- Message posted via AccessMonster.com...
0
8704
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
8623
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
9192
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...
1
8939
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
7778
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...
1
6545
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4390
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
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3071
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.