• 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] Does this trigger leak?

Status
Not open for further replies.
Level 19
Joined
Oct 29, 2007
Messages
1,184
Well.. Does it? : O

  • Remove
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer tmp_integer) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(tmp_integer)) controller) Equal to User
              • ((Player(tmp_integer)) slot status) Equal to Is playing
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • detect_up[tmp_integer] Equal to 1
                • Then - Actions
                  • Set tmp_loc2 = (Position of Player[tmp_integer])
                  • Set tmp_loc = (tmp_loc2 offset by 800.00 towards (Facing of Player[tmp_integer]) degrees)
                  • Custom script: call RemoveLocation(udg_tmp_loc2)
                • Else - Actions
                  • Set tmp_loc = (Position of Player[tmp_integer])
              • Set tmp_group[tmp_integer] = (Units within 1000.00 of tmp_loc)
              • Custom script: call RemoveLocation(udg_tmp_loc)
            • Else - Actions
      • Set tmp_group[5] = (Units in (Playable map area))
      • Unit Group - Pick every unit in tmp_group[5] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Grass
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • ((Picked unit) is in tmp_group[1]) Equal to False
                      • ((Picked unit) is in tmp_group[2]) Equal to False
                      • ((Picked unit) is in tmp_group[3]) Equal to False
                      • ((Picked unit) is in tmp_group[4]) Equal to False
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_tmp_group[1])
      • Custom script: call DestroyGroup(udg_tmp_group[2])
      • Custom script: call DestroyGroup(udg_tmp_group[3])
      • Custom script: call DestroyGroup(udg_tmp_group[4])
      • Custom script: call DestroyGroup(udg_tmp_group[5])
 
Level 14
Joined
Nov 18, 2007
Messages
816
Destroying Groups leaks. The solution would be using a group stack that recycles them (CreateGroup()-->NewGroup(); DestroyGroup()-->ReleaseGroup()). Problem with using that in GUI is that most BJs return a new Group everytime theyre called. That can be overcome with directly using the Enum natives.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
He's talking about group handle recycling, and saying DestroyGroup leaks is about as wrong as screwing babies in your basement.
Handle recycling is there to ensure there won't be any handle stack corruption (==> hurray for people that can't code) and also because it means you don't have to constantly create and destroy groups, which should theoretically speed up your code. But the jass behind NewGroup and ReleaseGroup probably makes that last part irrelevant (==> meh).

But saying DestroyGroup leaks makes me thing deaod is currently stoned. Or maybe he doesn't know what a leak is. Or maybe both.
 
Level 8
Joined
Nov 9, 2008
Messages
502
I thought DestroyGroup() was there to PREVENT leaks Oo lol
I don't think the trigger leaks.

The way I test for leaks is use FRAPS and watch the FPS count. MASS the trigger I think is leaking and if the FPS degrades over time then I'm leaking.
 
Level 9
Joined
Feb 14, 2009
Messages
316
I think this way:

(Picked Unit) = GetEnumUnit() = a function
tmp_unit = udg_tmp_unit = a stored value

I think stored values are faster to access...

Calling a function is always slower than using variables.

--------------------------------------------------------

Destroying groups doesn't leak since it doesn't keep anything in memory lol.
Ever heard of GetLastDestroyedGroup() ? Complete lol.
 
Level 14
Joined
Nov 18, 2007
Messages
816
No it doesn't.
Yes, it does. Use certain natives (GroupEnumUnitsInRange, GroupEnumUnitsOfPlayer, GroupEnumUnitsInRect,...) on groups and destroy those groups later--->leak. Not that much i think, but still, its a leak. Average GUI users shouldnt care about that.

open the attached map in your JNGP and hit the test map button (start wc3 in windowed mode). Make sure to have the taskmanager running in the background.

Edit: This is ridiculous. I'm stoned, and dont know what a leak is? Yeah, right.
Eleandor, you have no clue what handle recycling is for. And why theres only timer recycling and group recycling out there (to my knowledge; every other handle recycling is bullshit, imo).
 

Attachments

  • GroupsTest1.w3m
    8 KB · Views: 76
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
Yes, it does. Use certain natives (GroupEnumUnitsInRange, GroupEnumUnitsOfPlayer, GroupEnumUnitsInRect,...) on groups and destroy those groups later--->leak. Not that much i think, but still, its a leak. Average GUI users shouldnt care about that.
It doesn't. Your testmap is testing the wrong thing. DestroyGroup doesn't leak, the group enumeration functions do. And sadly for you, there's no way around using group enumeration functions, and you'll have the same leaks with group recycling. They'll just have much less of an impact. Don't try to fool me with a wrong testmap...

Edit: whatever direction you're gonna take this thread to, since it's GUI here there's no way he's going to be using a group recycling system anyway, and it doesn't leak.
 
Level 8
Joined
Aug 6, 2008
Messages
451
I recycle all public units too. It helps when making custom resurection things and stuff like that and allows me to create non leaking damage detection systems and makes unit indexing easy, simple, nice and smooth.

Timers and groups should be recycled. ( At least I recycle them and it makes things easier in many ways )

Recycling is good, it saves environment!

Hell, I would probably recycle effects too, if there was some ChangeEffectModel function...
 
Level 14
Joined
Nov 18, 2007
Messages
816
Eleandor, now guess what, if you replace that local group with a static one, it stops leaking. Fuck, DestroyGroup() LEAKS. So, unlike you i actually verify my claims. Unlike you, i dont talk about things i have no clue about.
 
Status
Not open for further replies.
Top