quick memory leak question

Dois

New Member
Reaction score
1
Hi... will this leak?

Code:
Leaderboard - Create a leaderboard for (Player group((Player((Player number of (Owner of (Triggering unit))))))) titled (Hero revives in  + (String((20 + (Hero_Level[(Player number of (Owner of (Triggering unit)))] x 2)))))

Cuz i've heard that "Pick every player in (All players)" wont leak. but (All players matching condition XXXXYYYZZZ) will leak.

So I'm wondering if this player to player group conversion will leak?

Or am I wrong about that "pick ever player in (all players)" anyway?

Thanks...
 

Builder Bob

Live free or don't
Reaction score
249
It will create a player force that is not destroyed, so it will occupy a small bit of memory. However, you are likely only creating that leaderboard once in the game, so the amount of memory lost to the force created this way will not increase as the game goes on.

I wouldn't define it as a leak, but you can destroy the player group if you want to be tidy.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> "Pick every player in (All players)" wont leak. but (All players matching condition XXXXYYYZZZ) will leak.

Correct on both.

> So I'm wondering if this player to player group conversion will leak?

Yes. It creates a new group with one player on every call.
 

Dois

New Member
Reaction score
1
Sorry looks like i gotta ask another thing... Do LEADERBOARDS leak?

Cuz that leaderboard thing is gonna be a timer for my heroes.

A countdown timer for until the hero will revive...
 

Dois

New Member
Reaction score
1
oh cuz im using the leaderboard as a timer for the heroes to revive.

its nicer than a "Timer Window" and it appears below the mult-boards...

Also... i got another question...

i saw cleeezzzz or whatever his name was doing this...

Code:
custom script: local integer udg_TestLoop

and then

Code:
For each (Integer TestLoop) from 1 to 10, do (Actions)
                            Loop - Actions
                                Unit - Create 1 Creep[WaveCounter[1]] for Player 7 (Green) at RegionsStart[1] facing Default building facing degrees
                                Wait 0.50 seconds

both in the same trigger of course... So Can I do that?

i remember you saying that "for each (integer A) and (integer B)..." integers A and B are globals so I cant have waits and I'll need to use a diff integer variable for every loop that has a WAIT in it.

Can i do what hes doing? I dont see him destroying the local integer at the end of the trigger...

So does that way of using integers in loops work?

Cuz now I have this global variable IntegerC and its a long array...

I use it for every "For each (IntegerC[1])" that has a wait in it... and its really messy and annoying...

So can I do what hes doing? just "local udg_IntegerC" and use it for everything?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> I don't see him destroying the local integer

That's automatic.

All local variables are automatically destroyed at the end of the trigger.
And, actions like RemoveLocation or DestroyGroup are not used to destroy the variable, but the content!

Integers are the content. As such, there's nothing to destroy there...
 

Dois

New Member
Reaction score
1
custom script: local integer udg_variable

umm when i put
Code:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Custom script:   local integer udg_IntegerX
        -------- Setup --------
        Visibility - Disable fog of war
        Visibility - Disable black mask
        Game - Set the time of day to 5.99
        Game - Display to (All players) the text: |c00feba0eChoose|r ...
        Unit - Add Crow Form to Locust Circle of Power (Floating) 0072 <gen>
        Unit - Remove Crow Form from Locust Circle of Power (Floating) 0072 <gen>
        Unit - Add Crow Form to Locust Circle of Power (Floating) 0071 <gen>
        Unit - Remove Crow Form from Locust Circle of Power (Floating) 0071 <gen>
        Unit - Add Crow Form to Locust Circle of Power (Floating) 0075 <gen>
        Unit - Remove Crow Form from Locust Circle of Power (Floating) 0075 <gen>
        Unit - Add Crow Form to Locust Circle of Power (Floating) 0076 <gen>
        Unit - Remove Crow Form from Locust Circle of Power (Floating) 0076 <gen>
        Animation - Change Demon Gate 0087 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 25.00% transparency
        Animation - Change Demon Gate 0088 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 25.00% transparency
        Animation - Change Demon Gate 0089 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 25.00% transparency
        Animation - Change Demon Gate 0090 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 25.00% transparency
        Animation - Change Converter (southeast facing) 0091 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 30.00% transparency
        Animation - Change Converter (southwest facing) 0092 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 30.00% transparency
        Set Temp_UGroup = (Units in West Cannon Area <gen> matching (((Matching unit) is A structure) Equal to False))
        Unit Group - Pick every unit in Temp_UGroup and do (Actions)
            Loop - Actions
                Unit - Pause (Picked unit)
                Unit - Make (Picked unit) Invulnerable
        Custom script:   call DestroyGroup(udg_Temp_UGroup)
        Set Temp_UGroup = (Units in East Cannon Area <gen> matching (((Matching unit) is A structure) Equal to False))
        Unit Group - Pick every unit in Temp_UGroup and do (Actions)
            Loop - Actions
                Unit - Pause (Picked unit)
                Unit - Make (Picked unit) Invulnerable
        Custom script:   call DestroyGroup(udg_Temp_UGroup)
        -------- Quest --------
        Quest - Create a Required quest titled Beginners' Informat... with the description Select a hero and f..., using icon path ReplaceableTextures\CommandButtons\BTNResStone.blp
        Quest - Create a Optional quest titled General with the description Thanks everyone at ..., using icon path ReplaceableTextures\CommandButtons\BTNArcaneVault.blp
        Quest - Create a Optional quest titled Models/Misc with the description Thank you...    Vex..., using icon path ReplaceableTextures\CommandButtons\BTNArcaneSanctum.blp
        -------- Variables --------
        Set Players_Playing = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))
        Set Players_West = (All players matching ((((Matching player) controller) Equal to User) and ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 6 (Orange)) Equal to True))))
        Set Players_East = (All players matching ((((Matching player) controller) Equal to User) and ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 12 (Brown)) Equal to True))))
        Set RandomUnits = (Units in Random Units Group <gen>)
        Set Player_Colours[1] = |c00ff0303
        Set Player_Colours[2] = |c000042ff
        Set Player_Colours[3] = |c001ce6b9
        Set Player_Colours[4] = |c00540081
        Set Player_Colours[5] = |c00fffc01
        Set Player_Colours[6] = |c00feba0e
        Set Player_Colours[7] = |c0020c000
        Set Player_Colours[8] = |c00e55bb0
        Set Player_Colours[9] = |c00959697
        Set Player_Colours[10] = |c007ebff1
        Set Player_Colours[11] = |c00106246
        Set Player_Colours[12] = |c004e2a04
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) is in Players_Playing) Equal to True
                    Then - Actions
                        Set IntegerX = (IntegerX + 1)
                        Set PlayerQueue[IntegerX] = (Player((Integer A)))
                    Else - Actions
        For each (Integer A) from 7 to 11, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) is in Players_Playing) Equal to True
                    Then - Actions
                        Set IntegerX = (IntegerX + 1)
                        Set PlayerQueue[IntegerX] = (Player((Integer A)))
                    Else - Actions
        -------- Monster Vars --------
        Set Monsters[1] = Footman (Level 1)
        Set Monsters[2] = Ghoul (Level 2)
        Set Monsters[3] = Grunt (Level 3)
        Set Monsters[4] = Archer (Level 4)
        Set Monsters[5] = Satyr (Level 5)
        Set Monsters[6] = Giant Wolf (Level 6)
        Set Monsters[7] = Furbolg (Level 7)
        Set Monsters[8] = Dark Troll Berserker (Level 8)
        Set Monsters[9] = Raider (Level 9)
        Set Monsters[10] = Necromancer (Level 10)
        Set Monsters[11] = Berserk Wildkin
        Set Monsters[12] = Centaur Khan
        Set Monsters[13] = Pig
        Set Monsters[14] = Alchemist
        Set Monsters[15] = Beastmaster
        -------- Spawns --------
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Turn Gives bounty On for (Picked player)
        Player Group - Pick every player in Players_Playing and do (Actions)
            Loop - Actions
                Player - Set (Picked player) Current gold to 75
                Set Temp_Point[1] = (Position of Ashenvale Tree Wall 1335 <gen>)
                Set Temp_Point[2] = (Temp_Point[1] offset by 250.00 towards (90.00 + (30.00 x (Real((Player number of (Picked player)))))) degrees)
                Unit - Create 1 Soul for (Picked player) at Temp_Point[2] facing Temp_Point[1]
                Camera - Lock camera target for (Picked player) to (Last created unit), offset by (0.00, 0.00) using Default rotation
                Selection - Select (Last created unit) for (Picked player)
                Custom script:   call RemoveLocation(udg_Temp_Point[1])
                Custom script:   call RemoveLocation(udg_Temp_Point[2])
        -------- Special Effects --------
        Special Effect - Create a special effect attached to the origin of Locust Circle of Power 0069 <gen> using Abilities\Spells\Other\Drain\DrainTarget.mdl
        Special Effect - Create a special effect attached to the origin of Locust Circle of Power 0070 <gen> using Abilities\Spells\Other\Drain\ManaDrainTarget.mdl
        Special Effect - Create a special effect attached to the origin of Locust Circle of Power 0074 <gen> using Abilities\Spells\Other\Drain\DrainTarget.mdl
        Special Effect - Create a special effect attached to the origin of Locust Circle of Power 0073 <gen> using Abilities\Spells\Other\Drain\ManaDrainTarget.mdl
        -------- Destroy Trigger --------
        Custom script:   call DestroyTrigger( GetTriggeringTrigger() )

when i put that at the start of the trigger, a lot of stuff stops working like how it should...

anyone know why? I cant do that @ map intialization? or some other reason?

(When i put the "Custom script: local integer udg_IntegerX" on top, without that, its fine... i think)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Custom script: local integer udg_IntegerX = 0

Actually, those pseudo locals are just evil incarnate waiting for trouble to happen.
If you need local stuff, go JASS. Otherwise use more globals.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top