ScriptSpot home

Forum topic · General Scripting

Delete an instance of a Structure (destructor)

By Rodman · 2013-12-09

Description

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 (4)
Branko Živković

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

***

Ok, so the code below is correct ?


Struct theStruct
(
 -- some stuffs here, allocating memory
)

instance = theStruct()

instance = undefined -- clear the memory
instance = theStruct()
Reply to Rodman
Branko Živković

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