Freeing Dynamic Arrays

H

headware

Do you have to manually release memory allocated by creating a dynamic
array using ReDim? In other words, if I have the following code:

ReDim Test(1000)
For i = 0 To 1000
Test(i) = "test value " & i
Next

Do have I have set Test = Nothing to prevent a memory leak?

Thanks,
Dave
 
P

Peter Bromberg [C# MVP]

Firstly, arrays as you describe them are not "dynamic" - the VB.NET "Redim"
keyword simply creates a new array and copies the contents to it.
When an array goes out of scope, it is marked for garbage collection, so you
do not need to do anything.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Freeing Dynamic Arrays 1
Freeing Dynamic Arrays 2
Error freeing memory.... 14
Checkbox arrays 6
Freeing memory 5
Organization Assignment in C programming 0
Python not freeing memory (?) 2
problem with freeing data 11

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top