• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Fixing Leaks

Status
Not open for further replies.
Level 7
Joined
May 16, 2004
Messages
355
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?
 
Level 2
Joined
Nov 4, 2004
Messages
23
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.
 
Level 10
Joined
Jul 2, 2004
Messages
690
Komodo said:
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.

position of a unit IS a point.

and cant you just null all the variables in a function after using it?
 
Level 7
Joined
Aug 5, 2005
Messages
218
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.
 
Level 10
Joined
Jul 2, 2004
Messages
690
if you destroy before nullifying, then it wont be nulled and the variable would still exist there.
 
Level 5
Joined
Jun 9, 2004
Messages
181
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.
 
Status
Not open for further replies.
Top