• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Leaks: An Indepth Explanation

Level 40
Joined
Dec 14, 2005
Messages
10,532
This paints several different and unrelated things with one brush, and attempts to attribute the effects of object leaks to the causes of pointer leaks.

Also, I somehow doubt warcraft's allocator does an O(n) search for new indexes, seeing as there are simple and well-known algorithms to accomplish O(1) instead.
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
The rules on leak removal is pretty simple, if that object is there to stay permanently, you don't have to null the handles pointing to it. The only examples I can think of for this are triggers that last the entire game and globals that point to one thing forever. So, pretty much, null everything that is a handle, even globals if you destroy what they're pointing at.
Player variables don't need to be nulled either.

There is also an exception to the entire leak thing: boolexpr. Boolexprs act like strings do. They are saved in a table. That is, creating a new filter that you've made before actually just gets the old filter. That's why it's not suggested to destroy filters, you don't even have to null them.
It's worth mentioning the advantages of using a global boolexp.
 
Top