• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] This leak to?

Status
Not open for further replies.
Level 12
Joined
Mar 17, 2007
Messages
412
Edit: Just noticed I posted in the wrong section

This is blacklisted
  • Unit Group - Pick every unit in (Units of type Footman) and do (Actions)
    • Loop - Actions

But this is not? so,,, would this fall in the same category or not?
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Footman) and do (Actions)
    • Loop - Actions
 
They both leak.

(Units owned...)
(Units in...)

etc. all create new groups. Basically, if it isn't a variable or preset used in the "Pick every" function, then it is creating a new group.

The solution is to either assign it to a global, and then destroy it at the end. Alternatively, you can just use this script and it will be fine:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Footman) and do (Actions)
    • Loop - Actions
The BJ equivalent to "Pick every..." will check if that flag is true. If so, it'll automatically destroy the group once it has finished doing the "Loop - Actions" part.
 
Level 12
Joined
Mar 17, 2007
Messages
412
  • Custom script: set bj_wantDestroyGroup = true

I've heard excessive rumors that this still causes leaks also other websites insist that you do NOT use them so I don't understand why this is being told here

||||||||||||||||||||||||

In preference I chose this

  • Custom script: call DestroyGroup(udg_VariableUnitGroup)
||||||||||||||||||||||||

My question still stands listed below I've heard that this still causes leaks even if after it's been destroyed I'm just trying to found out if that is true or not. For example say you use a periodic event every .10 second

  • Set VariableUnitGroup = (Units owned by Player 1 (Red) of type Footman)
  • Unit Group - Pick every unit in (VariableUnitGroup) and do (Actions)
    • Loop - Actions
  • Custom script: call DestroyGroup(udg_VariableUnitGroup)
||||||||||||||||||||||||
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
I've heard excessive rumors that this still causes leaks also other websites insist that you do NOT use them so I don't understand why this is being told here

In preference I chose this

  • Custom script: call DestroyGroup(udg_VariableUnitGroup)

Neither of them leak. They are both equally the same. This is what happens when using groups.
JASS:
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false
    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(sourceGroup)
    endif
It does the same thing as setting the boolean to true calls destroyGroup anyways.

My question still stands listed below I've heard that this still causes leaks even if after it's been destroyed I'm just trying to found out if that is true or not. For example say you use a periodic event every .10 second

  • Set VariableUnitGroup = (Units owned by Player 1 (Red) of type Footman)
  • Unit Group - Pick every unit in (VariableUnitGroup) and do (Actions)
    • Loop - Actions
  • Custom script: call DestroyGroup(udg_VariableUnitGroup)

The above causes a handle leak. Something that cannot be fixed using GUI. Unless you use custom script to create all of your groups that use that. But if you avoid them then use an ITE inside the group loop it does not leak and it will allow you to only do the things you want to those units of that type.
 
Status
Not open for further replies.
Top