Warcraft III resources & community, 2003–2006 · archived

Fixing Leaks

8 posts
#1

Fixing Leaks

Alright I understand what a leak is and such, but I need to know every type of leak and the proper way to deal with them using custom scripts. Also I need to know how they are created. And lastly I have a question regarding position leaks, does referencing to the Target Point and such leave a leak and when i create a dummy they need to have their position destroyed right?
#2
Only one which ever bothers me is the location one. If you ever define a Point on the map just make sure you remove it. Most of the time I use other things such as regions or positions of units rather then Points. Im interested to see what some experienced map makers have to say on this though.
#3
Thats what I wanted. I want a complete list of leaks and how to fix them so that I can patch them for my map. Cause right now it leaks like a bottomless boat.
#4
KomodoOnly one which ever bothers me is the location one. If you ever define a Point on the map just make sure you remove it. Most of the time I use other things such as regions or positions of units rather then Points. Im interested to see what some experienced map makers have to say on this though.


position of a unit IS a point.

and cant you just null all the variables in a function after using it?
#5
I don't think nullifying is necessary, just destroying.

To answer the OP

Point: make a point variable

example trigger
set tempPoint = random point in region 001
create unit at tempPoint
custom script - call RemoveLocation(udg_tempPoint)

Unit group: make a unit group variable

example trigger
set tempGroup = units in region 001
pick every unit in tempGroup and do kill picked unit
custom script - call DestroyGroup(udg_tempGroup)

Groups leak when you use "pick every unit" action. Those are the only 2 types of leaks that you need to worry about.
#6
if you destroy before nullifying, then it wont be nulled and the variable would still exist there.
#7
Thanks guys, I knew how to fix position leaks, i've been doing that destruction of the Point variables for a while now, I just wasn't sure what other types there are.
#8
I wanted to open a topic like that, but i saw it already exists, so i want to ask a few questions about leak.

You all say, i can prevent a leak by destroying the location. That makes sense in case of spells, where the location is always different.
But, what a bout locations that i will use later? So i have a periodic trigger that spawns units (AoS map) every x seconds to a location variable that always remains the same. I did not notice any leaks after hours of playing (probably because i have a lot of memory in my comp.), and i don't know why it is necessary to remove this location and then create it again every time the trigger runs.

Perhaps i don't understand well enough what makes a variable to leak.