|
Prev: asp datatable?
Next: File Attributes with ASP in HTML
From: headware on 12 May 2008 15:35 Do dynamic arrays declared using ReDim have to be freed? I assume that if it's an array of dynamically created objects (e.g. Scripting.Dictionary), each one of those objects will have to be set to Nothing in a for loop, but what about the array itself? Or what if the array is dynamic but it just consists of integers or strings, not dynamically allocated objects? Does it have to be set to Nothing? Thanks, Dave
From: Bob Barrows [MVP] on 12 May 2008 15:52 headware wrote: > Do dynamic arrays declared using ReDim have to be freed? I assume that > if it's an array of dynamically created objects (e.g. > Scripting.Dictionary), each one of those objects will have to be set > to Nothing in a for loop, Depending on the type of object, even that is not necessary since they will be released when they go out of scope. Of course, it doesn't hurt to do it. With ADO connections, it's probably a good idea to be explicit about closing and destroying them. With Dictionary objects, it's probably overkill. > but what about the array itself? Or what if > the array is dynamic but it just consists of integers or strings, not > dynamically allocated objects? Does it have to be set to Nothing? > Arrays are not objects so they cannot be set to nothing. Many years ago i read somewhere that it was a good idea to use Erase to clear arrays when done with them, but I have not seen that advice anywhere since. Again, it can't hurt. -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
|
Pages: 1 Prev: asp datatable? Next: File Attributes with ASP in HTML |