• 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.

Hash tables, do they leak?

Status
Not open for further replies.
Level 18
Joined
Jan 21, 2006
Messages
2,552
Well there are these functions too:

JASS:
native RemoveSavedInteger
native RemoveSavedBoolean
native RemoveSavedString

In addition to:

JASS:
native FlushParentHashtable
native FlushChildHashtable
 
I mean, well, you know how points are one of the most common leak?
Well, say you saved a point in a hash table, would you have to save the point as a temporary variable like P_Loc then clear the parent it is referenced in, then destroy the point?

Code:
    set udg_P_Loc = LoadLocationHandleBJ(0, 0, udg_HT_SomeName)
    call FlushChildHashtableBJ( 0, udg_HT_SomeName )
    call RemoveLocation(udg_P_Loc)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
As it is still a reference to a handle (location), I would say yes, you do.
And even if you don't, it doesn't hurt to do it anyway.

I wouldn't save locations though, instead I would save coördinates: they're a LOT better.
(faster, no problems like this, easy to use).

Edit: could you next time use [code=jass] [/code] or [trigger] [/trigger]?
(To copy/paste GUI-codes, right-click the trigger name above "events" and select "copy as text").
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Typically when I use hashtable values (usually the only thing you need to save is an integer, because of how structs are implemented) I just use RemoveSavedInteger to clear the memory references. I rarely use FlushChildHashtable or FlushParentHashtable.
 
Status
Not open for further replies.
Top