![]() |
|
#1
|
|||
|
|||
![]() Quote:
Memory assigned is restricted to 512 MB no matter of the size of RAM available. In filling up the "pot" it slows down speed. |
#2
|
||||
|
||||
![]()
In the middle of the run I can believe it could make a difference. But you did the two Set=Nothings at the very end of the program, right? It isn't obvious to me how that could make even an immeasurable difference. Am I missing something?
|
#3
|
|||
|
|||
![]()
Bob, I'm erasing set object variables from memory manually out of two reasons:
- Variables created within a macro should be erased from memory automatically once the macro is done. With set objects in former times it didn't always work this way and you were left to an error of stackoverflow in the worst case or to a poor performance. Since I don't know if the problem is fixed, I just continue erasing them manually. - The main reason: There are different types of objects, for instance classes you must unload manually; if creating a new instance of an object (whenever using the keyword "New") you have to unload it manually as well - even more important because depending of the object it might use huge capacity in memory. Now, tell me are there more? Lazy as I am, I don't want to think about it neither look it up, but destroy each of them manually once they did their job. And it's not a big deal to write the additional instructions. |
#4
|
||||
|
||||
![]()
I think you're saying that if I don't free an object manually, there are circumstances where it might not be freed by the VBA editor as the macro comes to an end. I don't think I ever knew that (or if I did, I forgot). That does make a difference, especially because I tend to leave my laptop on for a week or three at a time and Excel is unlikely to be closed at any time during that period. Run macros again and again, and this could get to be a problem.
Well, I don't know that I'll change my habits overnight. But at least I'm sure to be suspicious if things slow down suddenly, in the near future; I may discover that I'm well advised to do the same as you. |
#5
|
|||
|
|||
![]()
Bob, I forgot
Quote:
Leaving excel for long periods open in my opinion will result in any case that things slow down. I would expect that memory allocation after at least one day equals the limit. But I can't tell by experience, because usually I close excel at least every hour, unless it's doing calculations, but than memory is used to the limit. |
#6
|
|||
|
|||
![]()
Interesting:
Features: switch Set To Nothing = False, switch Throw Error = True Code:
23:25:33:0697 Call RangeCompare2: Don't Set to Nothing: WorkingSetSize 60.395.520 ( Reference ) 23:25:33:0707 Start Timer: t = 0.000 sec: WorkingSetSize 60.403.712 ( 8.192 ) 23:25:33:0717 arrCompare Loaded: t = 0.008 sec: WorkingSetSize 61.366.272 ( 970.752 ) 23:25:33:0747 objDic Loaded: WorkingSetSize 61.693.952 ( 1.298.432 ) ERROR: 450: Wrong number of arguments or invalid property assignment 23:25:33:0747 after End Sub: WorkingSetSize 60.719.104 ( 323.584 ) What can we make of this? CoolBlue, I enjoy playing with your tool ![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wierd "script code" in a downloaded .doc file | CNBarnes | Word | 2 | 10-18-2012 02:07 AM |
![]() |
krishnaoptif | Word VBA | 9 | 06-22-2012 05:08 AM |
![]() |
Jamal NUMAN | Word | 2 | 07-03-2011 03:11 AM |
Rules and Alerts: "run a script"? | discountvc | Outlook | 0 | 06-15-2010 07:36 AM |
An "error has occurred in the script on this page" | decann | Outlook | 8 | 09-03-2009 08:54 AM |