Does this Leak?

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,347
Just wondering if this leaks:

  • Item - Pick every item in (Playable map area) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Picked item)) Equal to Rune of Healing
              • (Item-type of (Picked item)) Equal to Rune of Mana
              • (Item-type of (Picked item)) Equal to Rune of Shielding
        • Then - Actions
          • Item - Remove (Picked item)
        • Else - Actions
I couldn't find a way to create a variable of type "Item Group" like you would with a "Unit Group",
therefore there is no way to destroy it with custom script.
 
Just wondering if this leaks:

  • Item - Pick every item in (Playable map area) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Picked item)) Equal to Rune of Healing
              • (Item-type of (Picked item)) Equal to Rune of Mana
              • (Item-type of (Picked item)) Equal to Rune of Shielding
        • Then - Actions
          • Item - Remove (Picked item)
        • Else - Actions
I couldn't find a way to create a variable of type "Item Group" like you would with a "Unit Group",
therefore there is no way to destroy it with custom script.

(Playable map area) doesn't leak, the same with (All Player)
 
The item group leaks.

  • Custom Script: set bj_wantDestroyGroup = true
Add this custom script before creating the item group, and it won't leak anymore.
The script you gave is for unit groups and will not do anything in this case. Item groups don't have such a thing.
It is safe to use "pick every item in rect" without having to do anything special.
 
I couldn't find a way to create a variable of type "Item Group" like you would with a "Unit Group",
therefore there is no way to destroy it with custom script.

Therefore there is no persisting object. Basically, if a function does not return a new object, which you could potentially save in a variable, it should not leak other objects. Else the function is crap.

@Kala, ap0calypse: Jass knows no type "item group".
 
@Kala, ap0calypse: Jass knows no type "item group".
I actually knew that, I have no clue why I just didn't say it the way you did just now :P
Way easier to understand.

Well but "(Playable map area)" is a leak isn't it? The item group itself like you use it is no leak!
No, it's a reference to a variable ("bj_mapInitialPlayableArea"). It's much like the "All Players"-force in the way that player groups (forces) generally leak, but "All Players" is just a reference to a variable, so removing that would be disastrous :P.
 
Status
Not open for further replies.
Back
Top