question about unit group leak

afisakov

You can change this now in User CP.
Reaction score
37
I know that if u make unit groups and fail to destroy them it leaks, but what happens if u justadd units to a group
more precisely i found a line going
Trigger:
  • Unit Group - Add all units of (Units in (Playable map area) matching ((Level of Legion TD Tower for (Matching unit)) Equal to 1)) to Legion_TD
in a map i'm helping someone with
1) does this inherently leak because it orders "(Units in (Playable map area) matching" and creates a new unit group while running?
2) what happens when it tries to add a unit that is already in the group from the last time this trigger ran?
 
I just confirmed what xtian said, it does leak because the GetUnitsInRangeOfLocMatching function is called and that group is not destroyed, that is unless you: set bj_wantDestroy = true in a custom script beforehand, but that will create issues with other functions more than likely

EDIT: theres issues with the jass tags right now

EDIT2:
you can do something like this:


Custom Script: set bj_wantDestroy = true
Unit Group - Add units blah blah blah
Custom Script: set bj_wantDestroy = false

EDIT3:

Omg there is seriously something wrong with this parser, completely effing up jass and wc3 tags
 
Thank you for the help.
I replaced it with
Trigger:
  • Set Legion_TD = (Units in (Playable map area) matching ((Level of Legion TD Tower for (Matching unit)) Equal to 1))

and placed
Code:
Custom script:   call DestroyGroup (udg_Legion_TD)
in a later trigger to get rid of it.

Just to make sure, it is ok to make in one trigger and destroy in another as long as it is not made again in between, right?

Semi related question, does
Code:
Unit Group - Pick every unit in (Units of type Water Elemental (Level 1)) and do (Unit - Remove (Picked unit) from the game)
leak if there are no water elementals in the map? aka will any later lag result from making empty unit groups, because it seems a pain to clean up something that rarely gets to function
 
Just to make sure, it is ok to make in one trigger and destroy in another as long as it is not made again in between, right?
So long as you can reference it after you're done using it, you won't be leaking anything. But be careful of multiple instances of the trigger running at the same time.

does
Code:
Unit Group - Pick every unit in (Units of type Water Elemental (Level 1)) and do (Unit - Remove (Picked unit) from the game)
leak if there are no water elementals in the map? aka will any later lag result from making empty unit groups, because it seems a pain to clean up something that rarely gets to function
Empty unit groups are still unit groups, and thus should leak like any other unit group.
 
Darn, more work
but thanks for the heads up

I guess I was hoping that with nothing in it, the group wouldn't take up a meaningful amount of memory, thus I wouldn;t have to work to get rid of it.
 
You should clear anything that MIGHT leak. Just in case.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top