..Type data freeing..
BlitzMax Forums/BlitzMax Programming/..Type data freeing..
| ||
..what would be best/most elegant way to free data in entire Type collection with GC? What would be the proper way of doing same thing but only for specific data inside type collection, not entire data stored in types? |
| ||
Set any variables in question to Null. |
| ||
Well, not exactly.. for example, if you have type references that are also attached to Tlists they will not be disposed of... you just need to think.. is the content of this type referenced anywhere else... if not... ya, just set the type reference to null or remove it from the Tlist and everything else will go with it. |
| ||
..what will happen with fields that representing some other Type structure..like.. Type TBlock_01 global Block_01_List:TList a:int b:int c:TBlock_02 End Type Type TBlock_02 Global Block_02_List:TList e:int f:int g:TBlock_03 End Type so if i say 'Something.c = null' whats going to happen with fields within TBlock_02 and TBlock_03 ? |
| ||
That will depend on whether there are any other references to the specific TBlock_02 and TBlock_03 objects in question. |
| ||
TBlock_02 will be collected and The Block_02_List TList would be lost meaning anything referenced by that TList would be lost if no other references exist, and the TBlock_03 would be collected if not null |
| ||
The Block_02_List TList would be lost meaning anything referenced by that TList would be lost if no other references exist No it wouldn't. Globals are static, they do not belong to a type instance, so they will not be affected by the GC collecting instances of that type. |
| ||
Oh yes quite correct |