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

[Trigger] Adding mana and exp leaks?

Status
Not open for further replies.
Level 4
Joined
Nov 24, 2007
Messages
33
EDIT: another problem. My head hurts.

my paranoia seems to be correct, as leaks are still in here.

though the bad thing is, it's worse than i thought

  • Jealousy
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching (((Matching unit) has buff Jealous ) Equal to True))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Unit = (Picked unit)
          • Set Temp_Point = (Position of (Picked unit))
          • Set Temp_Group2 = (Units within 500.00 of Temp_Point matching (((Unit-type of (Matching unit)) Equal to (Unit-type of (Picked unit))) and ((Matching unit) Not equal to (Picked unit))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of Temp_Unit) Equal to (Order(attack))
            • Then - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Temp_Group2 is empty) Equal to True
                • Then - Actions
                • Else - Actions
                  • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
                    • Loop - Actions
                      • Unit - Order Temp_Unit to Attack (Picked unit)
          • Custom script: call DestroyGroup(udg_Temp_Group2)
          • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call DestroyGroup(udg_Temp_Group)
this thing badly leaks handles for some reason and i don't know how to fix it. I've done everything in my knowledge and it still leaks very badly.

this is probably the only trigger that leaks in the map, or at least, more than others, as I tried disabling the trigger and the handles does not gradually increase as much as it is now.

so, how do i fix this?

the map in question: http://www.hiveworkshop.com/forums/maps-564/nuke-baka-v2-1-a-196904/
 
Last edited:
When I back to home, I'll look on it further, right now since in your first trigger you are just creating temporary groups, better use this:

  • Okuu Rage Mode
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
      • okuurage Equal to 1
    • Actions
      • Custom script: set bj_wantDestoyGroup = true
      • Unit Group - Pick every unit in ((Units of type Nuclear-Powered Hell Raven) or (Units of type Nuclear-Powered Hell Raven (Last Word))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is an illusion) Equal to False
            • Then - Actions
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 3.00)
            • Else - Actions
 
Level 4
Joined
Nov 24, 2007
Messages
33
never mind, it's not just the triggers that increase the counter.


high mana regen items also increases the counter quickly.

edit: it seems exp, game messages, and stuff also raises the counter.
which is weird, this didn't happen when i use the script on a spell-test map of mine.
the counter is 0 all the way, meanwhile in this map it starts far more than that.

can anyone tell me what does the JASS code my friend gave me do exactly?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
In Jealousy, you leak one location per 0.01 seconds and do not finish off the group in every case. Furthermore, the unit pick functions from GUI look like this:

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

They create a new group object, assign it to a local variable, return it. You destroy this object again with DestroyGroup but its handle id will not be released until all references (variables) on it are gone. Local variables are declared within a function call and do not automatically let go when the function has finished. Thereby, this reference here will not vanish and the handle id will remain reserved.
 
Level 4
Joined
Nov 24, 2007
Messages
33
In Jealousy, you leak one location per 0.01 seconds

oh crap.

  • Set Temp_Group2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to (Unit-type of (Picked unit))) and ((Matching unit) Not equal to (Picked unit))))
this you mean?

should making it

  • Unit Group - Pick every unit in Temp_Group and do (Actions)
    • Loop - Actions
      • Set Temp_Unit = (Picked unit)
      • Set Temp_Point = (Position of (Picked unit))
      • Set Temp_Group2 = (Units within 500.00 of Temp_Point matching (((Unit-type of (Matching unit)) Equal to (Unit-type of (Picked unit))) and ((Matching unit) Not equal to (Picked unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of Temp_Unit) Equal to (Order(attack))
        • Then - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Temp_Group2 is empty) Equal to True
            • Then - Actions
            • Else - Actions
              • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
                • Loop - Actions
                  • Unit - Order Temp_Unit to Attack (Picked unit)
      • Custom script: call DestroyGroup(udg_Temp_Group2)
      • Custom script: call RemoveLocation(udg_Temp_Point)
be better?

also, thanks for being one of the first people to actually give me feedback ;v;
 
Level 13
Joined
Mar 16, 2008
Messages
941
can anyone tell me what does the JASS code my friend gave me do exactly?
Handles in warcraft have an unique ID that allows you to easily identify them.
Most common used handles are units, locations, groups and effects. If you leak them you nearly can't see the increasing memory usage as it takes some time to sum up. These IDs are recycled if the handle doesn't exist anymore and all references (variables) are nulled. If you realy leak handles, that is something to avoid ;), this counter increased and it's easy to see.
 
Level 4
Joined
Nov 24, 2007
Messages
33
i see.

thanks for the help and the tutorial.

EDIT: now using the script given in the tutorial, and the amount of handles bounce between 2000 and 4000 (the 4000 just came out of nowhere, it's not gradual). i can't seem to figure out what is making the handles inflate like that, i mean, i'm pretty sure i removed all the possible leaks...

what am i doing wrong and what should i do?

EDIT2: i know that Jealousy is the main problem,
but how do i fix it? there are no leaks that i can see..

main post updated
 
Last edited:
Don't use 0.01 periodic, 0.03 is enough. You do not need additional group, first one you create just temporary and do nothing special with it, although simillar situation happens to second - but here you pick units as target for attacks.
By the way:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Temp_Group2 is empty) Equal to True
    • Then - Actions
    • Else - Actions
      • Unit Group - Pick every unit in Temp_Group2 and do (Actions)
        • Loop - Actions
          • Unit - Order Temp_Unit to Attack (Picked unit)
Why you order ONE unit to attack multiple targets at the same time? I'll target only the last unit in group.

Not sure how your whole spell looks like, since you have just shown the loop, but this should be somewhat you need:
  • Jealousy
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Jealous ) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of (Picked unit))
          • Set Temp_Group = (Units within 500.00 of Temp_Point matching (((Unit-type of (Matching unit)) Equal to (Unit-type of ((Picked unit)))) and ((Matching unit) Not equal to ((Picked unit)))))
          • Set Temp_Unit = (Random unit from Temp_Group)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Unit Not equal to No unit
            • Then - Actions
              • Unit - Order (Picked unit) to Attack Temp_Unit
            • Else - Actions
          • Custom script: call DestroyGroup(udg_Temp_Group)
          • Custom script: call RemoveLocation(udg_Temp_Point)
 
Level 4
Joined
Nov 24, 2007
Messages
33
Nope, still doesn't work.

The handles just keep rising and rising in number.

Yes, i changed the periodics to 0.03. still same result.


EDIT: yep, only the Jealousy trigger caused the whole map to leak. Turned it off and the handles are stable. The other triggers are fine.

EDIT2: ...except the last word phase triggers. they leak too for some reason, but it's temporary. (though they made 3k+ handles, but at least it's not constant)
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
I did not say it would be just Jealousy but I noticed it because you have a high-frequent double loop there. Everywhere where you pick yourself a new group together, the above mentioned problem occurs because the GUI functions work this way. Losing the handle ids also is not that bad of a performance leak when you destroy the objects behind them. But actually, as groups can be cleared/reset and such, you do not really need new objects everytime, instead it is practice to keep a permanent stack of them and just grab one when you need it/lay it back afterwards.
 
Level 4
Joined
Nov 24, 2007
Messages
33
I don't really know how to do that, though...

The permanent object stack thing, I mean.
The trigger is to pick any person coming in near the person with the Jealousy buff so that the person with the jealousy buff will be forced to attack (making them have to spam H or click away as fast as they can) the incoming person, friend or foe.
I don't really get how this works with the above mentioned solution...

I only have little experience in WC3 map debugging, and I'm trying my best to keep up/understand, sorry if I missed your point.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Well, you should actually go Jass before you meddle with this. As you realize, because GUI cannot do everything and you find whereabouts of the internal mechanics within them that most-likely someone told you about and now try to patch it up with apart custom scripts (Jass lines), Jass offers you a greater insight and more possibilities. I would not advise a GUI user to care about leaks if the problems were not outlined in reality, when you actually notice the consequences. Taking a look through your triggers, I have already seen that you picked other brute-force methods like the giant loops in Looping Skills and GUI itself is not efficient, so these other things may yield much more.
 
Status
Not open for further replies.
Top