|
-
Nov 7th, 2001, 07:04 AM
#1
Thread Starter
Fanatic Member
freeing memory... don't understand
hi all,
i've got something that may look a stupid question...
when i dim an object like this:
Dim MyVar(1000000) as string
then at the end of the project if i want to free it like this:
Set MyVar(1000000) = Nothing
i get a "object still needed error" even though i'm really not using that variable and it has not been declared public...
What am i doing wrong?
thanks,
w.
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Nov 7th, 2001, 07:08 AM
#2
PowerPoster
hi
Firstly, a million elements is far too small .. lets go for a billion! 
Set and Nothing are for objects not for arrays
The correct way is...
At top of form in declarations area
Dim MyVar() As String 'note no number for dynamic array
when u want to use it do...
Redim MyVar(1000000)
and when u want to clear it...
Erase MyVar
Regards
Stuart
-
Nov 7th, 2001, 08:16 AM
#3
Thread Starter
Fanatic Member
a million, no, a billion thanks ;-)
i do hope this is enough for memory management...
i don't know if i need a million but this number may vary from 10 to 1000000... so i put it up at max, even i know, this does slow down everything...
well if you do have another way to go... ;-)
thanks for your answer!
cheers,
w.
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Nov 7th, 2001, 08:20 AM
#4
Conquistador
You can make it larger at run time if need be
When you fill it, use
VB Code:
ReDim Preserve MyArr(10000)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|