Set point variable memory leak

futeki

Active Member
Reaction score
4
You know, of all the tutorials and searching I've done, I can't believe no one has asked this that I could find.

If you just set a point:
Trigger:
  • Actions
    • Set TempPoint = (Position of (Triggering unit))

Does that cause a memory leak?

Everything I've read so far addresses only if you're using that point:
Trigger:
  • Actions
    • Set TempPoint = (Position of (Triggering unit))
    • Unit - Create 1 Footman for (Triggering player) at TempPoint facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_TempPoint)


Nothing about setting it to a variable, and using it down the road in another trigger.
 

Crazy_Dead

New Member
Reaction score
24
i used to do this:

Trigger:
  • set Unit = (Triggering Unit())//OMG I'VE JASSED WAY TO MUCH
    • set loc = (Position of (Unit))


then remove leaks.
 

Heizo

New Member
Reaction score
0
It depends, If you are using it for a location, then it is fine, but if you are using it to say, spawn a dummy unit for a spell, just leaving it there will cause leaks once more and more pop up. So unless you use the exact same spot many times, it is better to just remove it.
 

futeki

Active Member
Reaction score
4
It depends, If you are using it for a location, then it is fine, but if you are using it to say, spawn a dummy unit for a spell, just leaving it there will cause leaks once more and more pop up. So unless you use the exact same spot many times, it is better to just remove it.

What if you're just setting it in one trigger, and using it in another?

Obviously if you remove it, the point is gone and unusable. Correct?

I've got 4 triggers firing off, and that point is needed in the 4th trigger.
 

Heizo

New Member
Reaction score
0
Then you should keep it until the fourth, then remove it after, unless a spell will be used in that exact spot at a later time, it just depends how often it will be used.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
What if you're just setting it in one trigger, and using it in another?

Obviously if you remove it, the point is gone and unusable. Correct?

I've got 4 triggers firing off, and that point is needed in the 4th trigger.

each time you set a variable, you use some memory to do so. this is not a leak, this is normal.
if you remove that point variable with custom script the memory is freed again, obviously thats the reason people are doing it.
however if you set a point variable to some location, then set the very same variable to another location before removing it you cannot remove the first point anymore. you have lost its reference. thats a memory leak. its memory you have used which cannot be freed again and slows down your computer for the rest of the game.

as long as you dont overwrite one variable before its contents are removed you do not leak memory.

however not all variables leak, unit variables for example dont. point, group, force, floating text and timers for example do.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top