• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Clearing hashtables?

Status
Not open for further replies.
Level 14
Joined
Nov 17, 2010
Messages
1,266
If I store an amount in a hashtable and constantly update that amount (in this case it is the damage done by my hero when he auto attacks) do I have to clear the old value stored in the hashtable before overwriting it to avoid leaks?

Basically I use a DDS and save the amount of damage he deals with an attack in the hashtable each time he attacks I update it to the new value so I can use that value for an ability. I’m just making sure it isn’t stacking up a bunch of leaks over time.

If it does leak how do I clear the old value before storing the new value?
 
Level 15
Joined
Feb 7, 2020
Messages
399
You should not have to do anything with a hashtable integer value being overwritten constantly since they recycle themselves; it should be safe. As far as I understand, only object generation typically leaks (because an object with a pointer won't properly be disposed of, or something like that). Things like reals and integers are pretty safe.

edit: there's a lot of good discussion on what leaks here [General] - I've been wondering about leaks...
 
Status
Not open for further replies.
Top