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

[Solved] Question about memoryleaks using Timer and SaveHandles

Status
Not open for further replies.
Level 3
Joined
Aug 27, 2011
Messages
41
I was wondering when using a function like
Code:
SaveUnitHandle(hash, GetHandleId(timer), 0, unit)

when you load using
Code:
unit = LoadUnitHandle(hash, GetHandleId(timer), 0)

when you null the unit out at the end does it also null the hash's field as well? Does it still contain the variable place holder, or since it saves the handle which is a integer does it not need to be nulled?
 
It doesn't null the hash field. To remove the data from the hash field, you must use:
JASS:
call RemoveSavedHandle(hash, GetHandleId(timer), 0)
Or you can flush the entire parent key:
JASS:
call  FlushChildHashtable(hash, GetHandleId(timer))

The first will just clear the data for that specific handle saved in that area. The second will clear all data saved under the handle id of timer.
 
Level 3
Joined
Aug 27, 2011
Messages
41
Oh dang, I was afraid of that, lol. Most of my coding is done in C++ and C#. So I'm used to values just being values, whether the value is a object or not lol. But I was looking at the code earlier and started thinking about having to null the hash field as well.

Thanks for letting me know I don't know how big of a memory leak it would of been but I'm glad I know now XD.
 
How difficult are they to learn and how efficient are they compared to hashes?

It is not difficult to learn, but it may be harder if you do not know vJASS. However, Table essentially is just a nicer API (programming interface), it doesn't improve the speed or anything like that. (since it uses hashtables itself, hence the name Table) You can stick with normal hashtables if you are already comfortable with them. :)
 
Status
Not open for further replies.
Top