• 🏆 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!

Clearing hashtables?

Status
Not open for further replies.
Level 14
Joined
Nov 17, 2010
Messages
1,265
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 14
Joined
Feb 7, 2020
Messages
387
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