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?
 
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.
 
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.
 
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
 
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)
 
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.
 
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
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top