Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
A question about Nothing
Hi
I understand what Nothing does: Set MyObject = Nothing But I don't understand the reason for it. Especially at the end of a routine Doesn't End Sub do the same thing? Dave F. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
A question about Nothing
In an ideal world, The app should tidy up after itself rendering the:
Set Object = Nothing as an excersize in futility, however some apps, mentioning no names (Access) have bugs in them which may be avoided by setting object variables to nothing at the end of the sub or function. P "Dave F" wrote in message ... Hi I understand what Nothing does: Set MyObject = Nothing But I don't understand the reason for it. Especially at the end of a routine Doesn't End Sub do the same thing? Dave F. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
A question about Nothing
Hi Dave
No. "Set" allocates memory for something. Say you have an object X that uses 2Mb ram. Then in theory it goes like this: Set A as new X '2 Mb allocated for future use Set B as new X 'and another 2 '.... do stuff with or without A and B, until Set A as noting 'release A's 2 Mb for use elsewhere Set B as nothing 'another 2 "In theory" because it doesn't always release, VBA or whatever program. In those cases you have a "memory leak" and your Pc starts acting sluggish for no obvious or logical reason. End Sub will or will not release memory, depending on wether the A variable is local or not, and also on luck (memory leak II ). Anyway it's a very good coding habit to release memory manually -we do have style after all ;-) -- HTH. Best wishes Harald Followup to newsgroup only please. "Dave F" wrote in message ... Hi I understand what Nothing does: Set MyObject = Nothing But I don't understand the reason for it. Especially at the end of a routine Doesn't End Sub do the same thing? Dave F. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If Question | Excel Discussion (Misc queries) | |||
Excel 2007 Macro/VB Question DDE Question | Excel Worksheet Functions | |||
where can I see my question and answer? Yesterday I ask a question | Excel Discussion (Misc queries) | |||
Newbie Question - Subtraction Formula Question | Excel Discussion (Misc queries) | |||
The question is an excel question that I need to figure out howto do in excel. | Excel Worksheet Functions |