Type memory leaks question

Blitz3D Forums/Blitz3D Beginners Area/Type memory leaks question

Talavar(Posted 2014) [#1]
I know that when I have an entity as a field under a type I need to FreeEntity and remove it before I delete the type object.. my question is, Do I need to zero out every numerical field as well, or will simply deleting the type object zero them all out automatically?


Guy Fawkes(Posted 2014) [#2]
Well, deleting the type object should 0 them automatically. At least that's what I see when programming my programs.


Matty(Posted 2014) [#3]
When you use the "freeentity" command it releases all the memory associated with that entity. You can do whatever you want with the variable that held that reference from that point on since it is now just a meaningless number.


Yasha(Posted 2014) [#4]
Do I need to zero out every numerical field as well, or will simply deleting the type object zero them all out automatically?


...why do you care about the values held in a nonexistent object?

Once the object is deleted, the fields are neither zero nor nonzero. They no longer exist.

(int and float values don't take up heap space, so it isn't meaningful to talk about freeing them, if that's what you meant; in any case, setting something to 0 would never free it or be relevant to freeing it anyway. Strings do take up heap space, but the language manages them behind the scenes for you, automatically freeing them when appropriate)

(if you're used to C and its "uninitialized variables" and have some concern based on that, don't worry - B3D auto-initializes things to zero on creation, this is a non-issue)