• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Do we need to null array members?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

Suppose I have a dialog and I store its buttons in an array of buttons. I then call DialogDestroy(d). Presumably this also destroys all the buttons. Now, do I need to go back to the array of buttons and null them all? Or does DestroyDialog(d) do that for me?

JASS:
local button array bttns
local dialog d
set d = DialogCreate()
set bttns[0] = DialogAddButton(...)
call DestroyDialog(d)
//now do I need to still null bttns[0]?
set bttns[0] = null //is this call necessary?
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
For example you run a certain spell quickly 20 times, but for the rest of the game you only have 2 cast simultaneously.
Now you have 18 instances which never will be overwritten or cleaned up.
Opinions vary when it comes to nulling, even along the veterans around here.
 
Status
Not open for further replies.
Top