point leak in hash

Status
Not open for further replies.
Level 5
Joined
Nov 25, 2004
Messages
65
  • Custom script: call RemoveLocation(udg_MyPointVariable)

i know that. but i am storing handle inside hash, not variable.

btw, look at this trigger, will this leak?

  • Untitled Trigger 003
    • Events
    • Conditions
    • Actions
      • Hashtable - Save Handle Of(Position of (Random unit from (Units in (Playable map area)))) as 1 of (Key point) in myHash
      • Wait 2.00 seconds
      • Custom script: call RemoveLocation(GetUnitLoc(GroupPickRandomUnit(GetUnitsInRectAll(GetPlayableMapRect())))
)
 
Level 5
Joined
Nov 25, 2004
Messages
65
you cant do that coz it leaks, store it in a variable first and do the remove thing that purge said...

ok i'll do it. btw, all kinds of handles do leaks right? so how to destroy a unit handle that has been stored in hash or a variable?
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
not all handles leak, so you dont need to destroy units/integers/strings/reals...but you should destroy points/lightning/sound etc...

you can also flush/clear the hashtable child so that it will clear any data for that type of ID...
Integers, strings and reals aren't handles.

@Caleb, What you need to do is, load the location from hashtable and assign it to a variable and then destroy it before flushing the child hashtable. Hashtable only points the location handle, flushing the child hash will remove the pointer and cause a leak which is why you need to remove the location first.
 
Status
Not open for further replies.
Top