• 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.

Leak Question Obv.

Status
Not open for further replies.
Level 7
Joined
Mar 6, 2006
Messages
282
Yes, I read the sticky, at least up to page 3. There's 51 pages, so... here I go.

Do either of these lines leak?

  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • -------- First one --------
      • Game - Display to Player Group - Player 1 (Red) for 30.00 seconds the text: string
      • -------- second one --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 10) Equal to 1
        • Then - Actions
        • Else - Actions
Thanks for reading.
 
Level 7
Joined
Mar 6, 2006
Messages
282
Neither of them leak. If you are using the preset player groups, you're not creating a new group. Therefore no leak. Also, All players doesn't leak, nor does loading a force handle from a hashtable. The rest of the functions require you to use a player group (force) variable to avoid a leak.

The random integer doesn't leak.

Ah, that's perfect then. Now I don't need to rewrite everything as I was anticipating, lol.

I just may bump this thread one more time tomorrow about boolean expressions, because I saw that they leak in the sticky, and I'm not sure how to handle them.
 
Level 7
Joined
Mar 6, 2006
Messages
282
And here's the bump!

So I heard that boolean expressions using "And" and "Or" leak, like this:


  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set TempGroup = (Units in Region <gen> matching (((Unit-type of (Matching unit)) Equal to Footman) and (((Matching unit) is alive) Equal to True)))
Does it leak?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
JASS:
function GetUnitsInRectMatching takes rect r, boolexpr filter returns group
    local group g = CreateGroup()
    call GroupEnumUnitsInRect(g, r, filter)
    call DestroyBoolExpr(filter)
    return g
endfunction

That's the Units In Region Matching Condition function, the passed boolexpr is destroyed.

JASS:
function GetBooleanAnd takes boolean valueA, boolean valueB returns boolean
    return valueA and valueB
endfunction

And this is the And function from GUI. So it only creates a boolexpr on the last step and this one gets cleared up:

JASS:
GetUnitsInRectMatching(rect, Condition(func))

Analogeously for Or. Actually, the Condition function does not leak dynamically anyway because functions are static, so one function does not need multiple boolexprs, it retrieves the same boolexpr then. The only scenario that has to be cleared up to avoid leaks is when you make use of the jass functions And and Or. Those are not the same ones as from GUI and combine two boolexprs to form a new one.
 
Status
Not open for further replies.
Top