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

Quick Question: Does this Leak?

Status
Not open for further replies.
Level 6
Joined
Apr 27, 2006
Messages
186
If you set a Point Variable more than once (lets say 1000 times), does it leak, or does it just overwrite the variable every single time it is set?

Oh, and another quick question, does this leak?
Set Temp_Point to equal Position of Picked Unit
Unit - Create 1 Locust at Temp_Point offset by 100 towards 10 degrees
Custom Script (call RemoveLocation (udg_TempPoint))
 
Level 11
Joined
Jul 12, 2005
Messages
764
Sure! It creates two location leaks.
1. 1 leak for the Polar Projection Offset
2. and inside the PPO, 1 for the Position of Picked Unit

Oh and i just noticed.
Aoen, your version still creates 1 leak. Correct one:
  • Set TempPointA = Position of Picked Unit
  • Set TempPointB = TempPointA offset by 100 towards 10 degrees
  • Unit - Create 1 Locust at TempPointB
  • Custom script - call RemoveLocation (udg_TempPointA)
  • Custom script - call RemoveLocation (udg_TempPointB)
 
Thank you very very much. Finally I solved this great mystery. So directly using function inside the action will surely cause leak. I would make a java comparison, I am sure you know it, you seem programmer type to me:

Let say we have two classes: class Main and class Argument
Main has a constructor with a parameter of type Argument

if we make this way:
Main variable = new Main(new Argument)

I am sure that the garbage collector will erase Argument type object which is used as a parameter after this statement, because no pointer points to it.

If we compare with JASS, no garbage collector is present, all dereferenced variables are not automatically deleted. It requires manual deletion. Even worse. if I make the way like above a thing in JASS, I cannot even delete it, as the pointer is not avalaible! So that method is not advisable to use. Then if I am not wrong, the Pick units action is useless (unless in cinematics maybe)!


WTF!!! Only 8 reputation points?? :confused: :sad:
 
Level 6
Joined
Apr 27, 2006
Messages
186
Actually Paskovich thats what I wanted to know in the first place, I just wanted to know if you would have to set the offset point to a new point, guess Happy Tauren was wrong :(, oh well thanks Paskovich and HappyTauren anyways.
 
Level 6
Joined
Oct 23, 2006
Messages
223
Uhmm these are basic things i doubt many ppol actually check for leaks in these unless your map is really really laggy already. I havent checked any leaks for my map yet it works fine even though it has a lot of demi-second events and does not remove stored variables.
 
Level 11
Joined
Jul 12, 2005
Messages
764
No Mechanical Man, that trigger uses an event-based variable (Entering unit). These do not leak, as they do not create new handles (like the locations). Local variables in jass are different, as they store data in the memory. In GUI, only the location leaks need "care". And special effects. Even if the effect does not have a "stand" animation, (so just sreates an effect once), they must be destroyed, as they remain on the map:

Create S.E. at <Loc> ...
Set SEvar = Last Created S.E.
Destroy SEvar
 
Level 11
Joined
Jul 12, 2005
Messages
764
They are an other type of variables, called generated variables. And they do not leak...
Btw, i forgot groups. They must be destroyed too:

Set TempGroup = Pick all units in Plyable Map Area
Pick all units in TempGroup ...
-Loop ...
call DestroyGroup(udg_TempGroup)
 
Status
Not open for further replies.
Top