• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Hash tables, do they leak?

Status
Not open for further replies.
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)
 
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").
 
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.
Back
Top