Does hashtable leaks?

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
I couldn't really find a decent clear hashtable tut for gui users, so i got to ask, does hashtable leaks if i overwrite a value that i have stored?
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
I couldn't really find a decent clear hashtable tut for gui users, so i got to ask, does hashtable leaks if i overwrite a value that i have stored?

As far as i know it does if you dont clear the childhashtable before overwriting it.

To be honest, i dont work with the editor anymore and i never really used hashtables but this is what i was told.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
well, i have stopped using world edit, but i got a request of a friend :p
and sincei never rly used hashtables in wc3 i though it was a good way to waste time :p

ontopic again:

can someone confirm if you need to clear childhashtables before overwriting them again?
 

keychup

Active Member
Reaction score
34
If you clear data from a hashtable, how will you ever call for the variable in your other triggers? isn't that the point of hashtables anyway? So that triggers can refer to the same data?

And btw, you can try clearing all child from the key parent. i don't think tuts saw that they had to explain something as plain as what can be read.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
you missed my point, lets say i save my gold in hashtable as 0 0 in MyHashtableTest, and then 30min later, i store my new current gold as 0 0 in MyHashtableTest, would this cause a leak?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
no, what causes leaks is handles being lost in the ram, and thats caused by a trigger running its course without removing any handles in the local variables, because they are still referenced, the issue with leaks in hashtables is say when you have a hashtable with data saved like this:
Trigger:
  • Hashtable - Save Unit SomeUnit as (Key SomeOtherUnit) of 0 in last created hashtable


then SomeOtherUnit dies and his handle is recycled, but there was a reference off that unit to another unit, that way "SomeUnit's" isnt recycled until the game uses the same exact handle it used for SomeOtherUnit again, and even then you would have to clear the new units hashtable, it basically winds up making a leak that "can" be removed but is very unlikely
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
In GFreak's example, I think 0 is the parent and (Key SomeOtherUnit) is the child. So to clear it you would clear all child hashtables of 0.

Or at least that's what I think. My knowledge of hashtables is confined mostly to using them.
 

keychup

Active Member
Reaction score
34
Then that means you can't simpley clear all children right? some may stop using it but others still are.
 

Dirac

22710180
Reaction score
147
Actually GFreak is both right and wrong, what mainly causes the leak is the creation of handles and leaving them loose around.
Basically the reason of why GUI groups leak, the editor creates it for enumeration, but when the variable is replaced and the previous group still exists, but no variable reffers to it so no one can ever destroy it now, piling it with the rest of non-destroyed groups, locations etc.
Doesn't have the same effect on units since unit handles are automatically recycled when the unit is removed or it's decay time ends.
"Hashtables" per se do leak
If you create 1 hashtable per spell you'll end up filling your ram of hashtables, they occupy a space in your RAM just by existing there, as well as anything does, the issue comes down when they pile up.
Clearing a child hashtable doesn't clear leaks, it might even cause them.
 

keychup

Active Member
Reaction score
34
Would this be appropriate?
420239_10150748753388574_770333573_12399247_176211340_n.jpg

As you can see i am implementing a single hashtable for moving units and another for other abilities. I have incorporated up to 2 abilities into the zz_movement_hashtable and 5 abilities into zz_ability_hashtable. Would this help prevent leaks?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Using one hashtable should be sufficient for most maps. Rather than using integers, you should use the (Key String) function. With integers you need a reference list to remember what refers to what; replacing them with things like (Key MovementAngle), (Key MovementTime), (Key MovementDistance) etc. lets you easily remember what they point to.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Actually GFreak is both right and wrong, what mainly causes the leak is the creation of handles and leaving them loose around.
~snip~
Doesn't have the same effect on units since unit handles are automatically recycled when the unit is removed or it's decay time ends.
"Hashtables" per se do leak.
~snip~

i did not realize that, i thought the handle remained as long as it was referenced somewhere, i guess thats a difference in GUI and Jass leaks, since GUI doesnt use locals, but i do think i got the main point accross... and ya, 1-2 hashtables is the most that should be used because they do take up extra space, Dota uses 2 currently and that is a very extensive game, the only reason to use more than 2 is for intensive systems, ie: Threat Systems, cast systems, etc, where many many units are recorded at once and you need both (Key Unit_1) of (Key Unit_2) and (Key Unit_2) of (Key Unit_1) in the same system and need it in another

and instead of using (Key String), create an integer variable called, say... Hash_Key_MovementAngle and just make sure it has a unique integer so u dont reference the same parent/child at once with 2 different systems, integers are more efficient than String handle calls because they actually call a function
 

Dirac

22710180
Reaction score
147
With vJass you only need 1 hashtable, doesn't matter how much use you give to it
And yes, sadly locals cause leaks, if you don't null them. The reason is that handle references do have a small impact on RAM storage, very small though, but locals are generated every time the function is called, and more and more references remain. Doesn't happen with globals because they are declared at initialization, you can't create a global during the game.

GUI -> Very hard to avoid leaks, LOTS of ram usage, LOTS of code size, LOTS of time wasted clicking OK buttons, LOTS of speed loss caused by heavy hashtable usage and timer spamming
vJass -> Avoiding leaks is easy, minimal ram usage, reduce code size considerably, saves you a lot of time by coding by your typing speed and using fully functional, speedyfreakish, pre-existed systems developed by other people online..... for free, also a vJass map runs at least 1500% times faster

It would be a fool that who denies to learn JASS IMO, no matter how "hard" it looks from your point of view, you can learn it in less than a few sessions
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i just wish that JNGP was getting updated more frequently, there are a few changes that would be nice, ie: expanding textmacros before modules and then static ifs after those, however at the moment i believe it's static ifs -> modules -> textmacros
eventhough textmacros are the most customizeable
if you could do it in the reverse order you could make WAY more versatile systems
or if you could take variable arguments or array arguments like in C++ rather than just flat value arguements
I do aggree with you that everyone should use vJass but 12% of people who own computers own macs, and JNGP doesnt work on Macs (idk about JH) which presents problems for a lotta people (like smitty)
 

Dirac

22710180
Reaction score
147
I have a Mac and I installed Windows XP through Bootcamp.
Silly impediments people hold on to not to learn vJass
And don't misjudge, I coded in GUI for a long time (Just search for my ChainHook spell)

And no, currently the compiler does this
module -> textmacro -> static if
So you can declare static ifs inside modules or textmacros to check if things exist where the user runs/places them. (Just read my Missile library or Nes's Unit Indexer)
It would be cool to take arrays for an argument, but it cant be done. The compiler isn't a language itself
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i know but its just a wish >.<
guess were stuck using Interfaces
and i was more concerned with the module -> textmacro as that held me back a while back ago with a system i was working on for my rpg
 

Dirac

22710180
Reaction score
147
There's always a way to avoid interfaces, no matter how ugly the API looks like.
are you sure that textmacros compile after modules? It's also a possibility that they compile at the same time in linear order (if there's a textmacro above a module then it should compile first)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
that was Per Nest and Luorax (if my memory isnt failing hard, which is totally feasible)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top