| Author |
Message |
stevech
Joined: 23 Feb 2006
|
|
Posted: 17 September 2006, 22:47 PM Post subject: arrays of strings - memory release |
|
|
may be a dumb question, but...
in this example:
dim myStrings(0 to 5) as string
...
myStrings(n) = cstr(x)
myStrings(n) = cstr(y)
will the storage for the string be automatically recovered each time that array element is rewritten?
(the code is just illustrative) |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Location: Portland, OR
|
|
Posted: 17 September 2006, 22:58 PM Post subject: Re: arrays of strings - memory release |
|
|
| stevech wrote: | | will the storage for the string be automatically recovered each time that array element is rewritten? |
Yes, just as it is for a scalar String variable. Moreover, memory is freed for string variables when they go out of scope. |
|
| Back to top |
|
 |
stevech
Joined: 23 Feb 2006
|
|
Posted: 17 September 2006, 23:43 PM Post subject: |
|
|
| VM-Power!!! |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Location: Portland, OR
|
|
Posted: 18 September 2006, 1:07 AM Post subject: |
|
|
| stevech wrote: | | VM-Power!!! |
The freeing upon subsequent assignment is performed by the VM. The freeing when going out of scope is realized by code generated by the compiler. You can see the generated instructions in the listing file. |
|
| Back to top |
|
 |
|