• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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
 
Level 11
Joined
Aug 24, 2008
Messages
106
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