Removing Leaks, when to kill the variables

Incognito

Member
Reaction score
1
If I use the same Temp unit group over and over, is it really necessary for me to remove it each time? I haven’t been doing so since I figured it would simply be writing over the same trigger and won’t leave a leak.

Off topic do either position of last created unit/item, or position of triggering unit cause a leak or is that handled by war 3?
 

BlackRose

Forum User
Reaction score
239
If I use the same Temp unit group over and over, is it really necessary for me to remove it each time? I haven’t been doing so since I figured it would simply be writing over the same trigger and won’t leave a leak.

Erm. Example usage? You just set group = blah and then call DestroyGroup() after I'm pretty sure.

Off topic do either position of last created unit/item, or position of triggering unit cause a leak or is that handled by war 3?

You need to set it to a location variable and then call RemoveLocation( location ) after. Using custom script. Else it will leak.
 

Skippy

Active Member
Reaction score
39
You have to destroy group each time.
When you have some group handle saved in variable Temp_Group and then assign to the Temp_Group some other group handle, the first group is "lost", you forgot the handle, you can't destroy it, it stays in RAM => it causes leaks.
 

Incognito

Member
Reaction score
1
So I would need to destroy it even if I was just like bellow

Set Tempgroup = Some group
Pick all in Tempgroup do something
(is removal really needed here?)
Set Tempgroup = Some group
Pick all in Tempgroup do something else

Edit: ah thx guys answered my question

Further more is there no easier way to clear all these leaks in gui, cus this seems to encompass pretty much every line of triggers, making more than 50% either setting a trigger or removing it :p
 

Jedi

New Member
Reaction score
63
If it doesn't need to be MUI, and if you are going to use SAME group again, you don't need to destroy and set it again.

Edit:

Trigger:
  • Set GroupVariable = some units owned by player
    • Unit Group - Pick every units in GroupVariable - Do something
    • Wait 99999 days
    • Unit Group - Pick every units in GroupVariable - Do something
    • -----I don't want to use it anymore
    • Custom script: call DestroyGroup(udg_GroupVariable)
 

Skippy

Active Member
Reaction score
39
If it doesn't need to be MUI, and if you are going to use SAME group again, you don't need to destroy and set it again.
I think he meant two different groups.

On topic: Yes, you need to destroy it, otherwise the first group will remain in memory and you won't be able to destroy it.

Notice that Tempgroup isn't the group itself, it is only a pointer to it.
 

Incognito

Member
Reaction score
1
Thx again guys,
One last thing off topic, what’s the custom code for removing a region if there is one? Or do I simply not need to remove regions at all after setting them.

p.s man u lot are fast and helpful o.o
 

Bogrim

y hello thar
Reaction score
154
It depends on how you handle the group. Whenever you unit the "Set Unit Group" or (bad) "Pick all units..." actions, you create a new unit group. If the previous group was not destroyed, you no longer have a way to handle the group and it's therefore lost but still taking up memory (henceforth, "memory leak").

If you merely add and remove units from an existing group, you don't need to destroy the group.

You typically create unit groups when you want to filter out units that shouldn't be affected by a spell or something like it, in which you should destroy the group after the group is of no more use.

You avoid destroying groups when you have groups for specific types, e.g. units affected by a healing over time effect, where you'd add and remove the units individually and use a periodic event to pick all the units under the effect.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top