Delete an instance of a Structure (destructor)

Hi,

The documentation doesn't mention how an instance of a structure is managed once it's created. Is there a destructor like in C++ ? In other words, can we release the memory used by this instance ?

I would say yes if you affect the value undefined to the instance but I'm not sure.

Also, if you create an instance twice (same name of the instance), the memory of the fisrt instance will be released or not ?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

I think using "undefined" is the answer for all your questions

barigazy

Rodman's picture

***

Ok, so the code below is correct ?

Struct theStruct
(
 -- some stuffs here, allocating memory
)
 
instance = theStruct()
 
instance = undefined -- clear the memory
instance = theStruct()

Rodman

barigazy's picture

...

Yup. But don't use word "instance" as variable

barigazy

Rodman's picture

Okay thanks Branko ! Yes the

Okay thanks Branko !

Yes the example is just to explain the problem.

Rodman

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.