Things That Leak

Level 12
Joined
Apr 27, 2008
Messages
1,228
  • Unit Spawn Init
    • Events
      • Destructible - Gate (Diagonal 1) 3003 <gen> dies
    • Conditions
    • Actions
      • Set Loc[1] = (Center of RunLoc <gen>)
      • Set Loc[2] = (Center of Spawn 1 <gen>)
      • Set Loc[3] = (Center of Spawn 2 <gen>)
      • Set Loc[4] = (Center of Spawn 3 <gen>)
      • Set Angle[1] = Angle Between Loc[2] and Position of Gate (Diagonal 1) 3003 <gen>
      • Set Angle[2] = Angle Between Loc[3] and Position of Gate (Diagonal 1) 3003 <gen>
      • Set Angle[3] = Angle Between Loc[4] and Position of Gate (Diagonal 1) 3003 <gen>
      • Trigger - Turn on Unit1 Spawn <gen>
      • Trigger - Turn on Unit2 Spawn <gen>
  • Unit1 Spawn
    • Events
      • Time - Every 18.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Unit1 for Player 12 (Brown) at Loc[2] facing Angle[1] degrees
      • Unit - Order (Last created unit) to Attack-Move To (Center of RunLoc <gen>)
      • Unit - Create 1 Unit1 for Player 12 (Brown) at Loc[3] facing Angle[2] degrees
      • Unit - Order (Last created unit) to Attack-Move To (Center of RunLoc <gen>)
      • Unit - Create 1 Unit1 for Player 12 (Brown) at Loc[4] facing Angle[3] degrees
      • Unit - Order (Last created unit) to Attack-Move To (Center of RunLoc <gen>)
Is the correct, not leaking way. If at some point you decide to stop spawning those units, you will not need the locations anymore and thus at that point you should remove the locations.

P.s. I wrote the "Angle Between" out of my head, but there is a function for an angle between locations.
 
Level 4
Joined
Apr 8, 2008
Messages
88
How do fix the leaks in those 2 examples, i know u do ( call RemoveLocation(udg_Fisherpoint[ ??? ]) ) but well... What should it be in
[ ] section?

  • Set Fisher_Point[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
  • Set Move_Fish_Here[(Integer A)] = (Curent_Pos[(Integer A)] offset by ((Real(Total_Range_Fishing[(Integer A)])) / 20.00) towards (Real(Degrees_Between_Fish_N_Fisher[(Integer A)])) degrees)
 
Level 11
Joined
Nov 20, 2007
Messages
661
How do fix the leaks in those 2 examples, i know u do ( call RemoveLocation(udg_Fisherpoint[ ??? ]) ) but well... What should it be in
[ ] section?

  • Set Fisher_Point[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
  • Set Move_Fish_Here[(Integer A)] = (Curent_Pos[(Integer A)] offset by ((Real(Total_Range_Fishing[(Integer A)])) / 20.00) towards (Real(Degrees_Between_Fish_N_Fisher[(Integer A)])) degrees)


I
  • Set Fisher_Point[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
Set (Player number of (Owner of (Triggering unit))) as a variable (Exemple :
Temp = Player number of (Owner of (Triggering unit))
Then

( call RemoveLocation(udg_Fisher_Point[Temp]) )

II
  • Set Move_Fish_Here[(Integer A)] = (Curent_Pos[(Integer A)] offset by ((Real(Total_Range_Fishing[(Integer A)])) / 20.00) towards (Real(Degrees_Between_Fish_N_Fisher[(Integer A)])) degrees)
( call RemoveLocation(udg_Move_Fish_Here[Integer A]) )
 
Level 4
Joined
Apr 8, 2008
Messages
88
  • Set Move_Fish_Here[(Integer A)] = (Curent_Pos[(Integer A)] offset by ((Real(Total_Range_Fishing[(Integer A)])) / 20.00) towards (Real(Degrees_Between_Fish_N_Fisher[(Integer A)])) degrees)
( call RemoveLocation(udg_Move_Fish_Here[Integer A]) )

Uhm.. At least I can't get the ( call RemoveLocation(udg_Move_Fish_Here[Integer A]) to work. sais it expects a name then.
 
I have a question about Sound leak. Why do sounds leak when playing? Also, obviosly, by destroying a sound I am unable to use it again.

They only are really considered a leak if you aren't using it anymore. Basically, if you are using them your entire map (or several times in general) you don't need to remove the sounds. If you perhaps play it once or so, and then you don't need it, then you should kill the sound.

how to destroy music? is it possibile?

You can't, and you don't need to. You can just use Music - Stop Music or whatever it is if you are just trying to stop it. But overall, I don't think music leaks.
 
Level 36
Joined
Sep 26, 2009
Messages
8,444
Music is not a leak, music is a string. When you do a "play music" call it just tells the game to read the assigned string path. That's solid hardcoding in a game full of loose and wayward objects.

"Leaking" is such a demonizing term for in-game objects. I mean, if you're constantly using CreateSoundFromLabel, for example, you need to destroy those. But even if you put 100 sounds in the sound editor and only use each one once, their allocation is so infinitesimal that it doesn't even matter. blizzard.j creates a bunch of sounds and other variables that most users never use, but you don't even notice the difference.
 
Level 14
Joined
Nov 20, 2005
Messages
993
You can't, and you don't need to. You can just use Music - Stop Music or whatever it is if you are just trying to stop it. But overall, I don't think music leaks.

Well, i'd need to, because i have a music(set before but not meant to play all the times) that plays again after another one is finished! I just want that last one to loop. I no more need the first one. :/
 
Level 17
Joined
Jan 21, 2006
Messages
2,545
Music has a very static implementation. There is no way of creating music, and as such there is no way of destroying it. You cannot destroy something that was not created. You could try using SetMusicPlayPosition to reset the music, but I don't think they intended on users using music for dynamic sound.
 
Level 7
Joined
Dec 18, 2008
Messages
400
From GUI, right? Same as global, but without the udg_ prefix.

Custom script: call RemoveLocation(nameOfLocation)

If you're in JASS you should bang your head against the wall for using locations.

Thanks :thumbs_up:
Well actually i'm using Jass (or atleast trying to learn it), why shouldn't i use location :eekani:?
 
Level 17
Joined
Jan 21, 2006
Messages
2,545
In GUI is bj_wantDestroyGroup flagged in the BJ unit-group functions? I suppose I could just open the editor, which I'm doing right now anyways...

Okay, so this is the ForGroupBJ function:

JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction

Now as soon as this is used bj_wantDestroyGroup should be flagged as false, which will mean that the next time this function is called it should still remain false. What gives the user control over this (or is it not controllable by the user?). GUI stinks.
 
Level 36
Joined
Sep 26, 2009
Messages
8,444
That "ForGroupBJ" is also known as "Pick Every Unit In Unit Group and Do..."

But you seem to be looking for "Last Created Unit Group"? That's a group that never leaks unless you destroy it (bad move, as it will cease all of your GUI unit creation).

There is a second group that is created if you actually reference the "last created unit group". If you ever use "get last created unit group" you will leak it, unless you set it to a variable and then destroy it. This is because bj_lastCreatedGroup is not equal to bj_groupLastCreatedDest (which ALWAYS leaks).


If I'm wrong, you need to rephrase what you're asking for.
 
Level 17
Joined
Jan 21, 2006
Messages
2,545
Bribe said:
without a single leak because blizzard was at least smart on that one

I would probably have preferred it if both doodad-groups and destructable-groups were both available in-game. It would be nice to at least be able to reference doodads/destructables properly. Doodads are objects in the game that bestow pathing obligations but you can't actually get their exact position, which sucks.
 
Level 8
Joined
Nov 9, 2008
Messages
502
Leaks slowly strangle your memory until there is no more left and your computer blows up. SO CLEAN YOUR LEAKS OR YOU WILL GET GLASS IN YOUR EYES!
 
Level 5
Joined
May 8, 2010
Messages
150
Why doesnt this stop the leak..
Custom script: call RemoveLocation(udg_playersbases[udg_Player number of Triggering player])

my original trigger is..

Player - Player 1 (Red) types a chat message containing random as An exact match
Player - Player 2 (Blue) types a chat message containing random as An exact match


((Triggering player) Current lumber) Equal to 100


Unit - Create 1 Heroes[(Random integer number between 1 and 20)] for (Triggering player) at (Center of playersbases[(Player number of (Triggering player))]) facing Default building facing degrees
Custom script: call RemoveLocation(udg_playersbases[udg_Player number of Triggering player])
 
Level 17
Joined
Jan 21, 2006
Messages
2,545
What the hell is "udg_Player number of Triggering player" supposed to do? I'm sure this just spits out a syntax error for you, am I correct?

For a pro map-maker you sure make nub mistakes. I would read a tutorial on how to use custom script.
 
Level 9
Joined
Jun 25, 2009
Messages
427
What the hell is "udg_Player number of Triggering player" supposed to do? I'm sure this just spits out a syntax error for you, am I correct?

For a pro map-maker you sure make nub mistakes. I would read a tutorial on how to use custom script.

Ouch berb, don't go like "Hey you mother f****ers!!! GET OVER HERE YOU LITTLE!!" on the poor guy :sad: He was just asking some questions.
 
Top