HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Leak Question

03-02-2009, 01:03 AM#1
Blackroot
You know I don't often work with point oriented spells; so I never actually noticed this one much, but there's no GetSpellTargetX/Y so you have to spin it off a location.

Expand JASS:

That shoulden't leak if I remember leaks correctly; but can someone confirm that?
03-02-2009, 01:15 AM#2
akolyt0r
i think it leaks... i usually do:
Collapse JASS:
local location l = GetSpellTargetLoc()
local real x = GetLocationX(l)
local real y = GetLocationY(l)
call RemoveLocation(l)
set l = null
03-02-2009, 01:38 AM#3
xombie
Yea, why not. Be safe.
03-02-2009, 01:42 AM#4
darkwulfv
ako's method is what is usually used and doesn't leak, so go with that.
03-02-2009, 04:36 AM#5
MaD[Lion]
u understand leak 50%
u asume seting a variable to it will prevent leak. Tat is not true, it only allow u to control the leak. Cus if u set these vars to null now (without destroying the locations) it still leak.
And if u dont null it and keep it tere (for some reason) it will still use memory space. So to prevent leak: set var to hold control of the memory space, free the memory with destroy when done with ur vars, set var to null.
Reason to set it to null is to free up the space this var is pointing to. Cus if u dont no other vars can be set to this var's space
03-02-2009, 09:33 AM#6
xombie
In my understanding of leaks there are two things you need to worry about.
  • Handle Reference Count
  • Handle Objects (such as returned from CreateTimer())

The "Handle Reference Count" is how many 'variables' have reference to that specific object. If you have two timer variables that both point to the same timer, then both of these would need to be set to null in order for something or other to get recycled.

The "Handle Objects" is what these 'variables' that I referred to previously point to. This needs to be destroyed in certain cases in order for the handle ID (I think) to be recycled.

Hopefully this helps your understanding.