• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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)
||||||||||||||||||||||||
 
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