1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  4. The Lich King has a new champion. The results for the 19th Icon Contest are here!
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Things That Leak

Discussion in 'Triggers & Scripts' started by Ralle, Jun 10, 2007.

  1. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,154
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    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.
     
  2. White-Lion

    White-Lion

    Joined:
    Dec 18, 2008
    Messages:
    393
    Resources:
    0
    Resources:
    0
    Thanks :thumbs_up:
    Well actually i'm using Jass (or atleast trying to learn it), why shouldn't i use location :eekani:?
     
  3. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,154
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Because locations are avoidable 99.99% of the time -- the only time you use locations is when you need to find the z-coordinate -- and only then.

    Use real values (local real x,local real y) instead of locations. Persay, GetUnitLoc should be GetUnitX and GetUnitY.
     
  4. White-Lion

    White-Lion

    Joined:
    Dec 18, 2008
    Messages:
    393
    Resources:
    0
    Resources:
    0
    okay i'll try this, thank you :D
     
  5. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    how to destroy the leak from one Last Created Unit Group?

    And for Destructible Group?
     
    Last edited: May 23, 2010
  6. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,154
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Last created unit group does not leak with "last created unit". Also, don't ever destroy "last created unit group".

    Destructable groups; there's no such thing.
     
  7. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    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:

    Code (vJASS):
    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.
     
  8. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    but how can I do this not in jass?
     
  9. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,154
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    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.
     
  10. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
    no no, you are right, thanks

    And to destroy one Doodad Group?
     
  11. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    You don't need to destroy doodad groups (I guess you are speaking of the Animation category, because this is the only part you can interact with doodads in-game, right?). There isn't any function to, after all.
     
  12. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,154
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Yeah, P is correct, because "Pick every destructable in X" does not generate a "Destructable Group". You can safely use destructable enumeration as often as you can handle it, without a single leak because blizzard was at least smart on that one.
     
  13. Raziel_br

    Raziel_br

    Joined:
    Oct 13, 2008
    Messages:
    554
    Resources:
    0
    Resources:
    0
  14. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    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.
     
  15. gthkeno

    gthkeno

    Joined:
    May 17, 2010
    Messages:
    24
    Resources:
    0
    Resources:
    0
    what is a leak? and what does it do?
     
  16. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    A leak is a memory allocation that is permanent (until the application is closed).
     
  17. Element of Water

    Element of Water

    Joined:
    Aug 3, 2008
    Messages:
    2,298
    Resources:
    5
    Spells:
    3
    Tutorials:
    1
    JASS:
    1
    Resources:
    5
    And it gradually fills up RAM until the system has to revert to storing "temporary" memory on the hard drive, which slows things down a lot.
     
  18. toofless

    toofless

    Joined:
    Nov 9, 2008
    Messages:
    496
    Resources:
    0
    Resources:
    0
    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!
     
  19. Element of Water

    Element of Water

    Joined:
    Aug 3, 2008
    Messages:
    2,298
    Resources:
    5
    Spells:
    3
    Tutorials:
    1
    JASS:
    1
    Resources:
    5
  20. toofless

    toofless

    Joined:
    Nov 9, 2008
    Messages:
    496
    Resources:
    0
    Resources:
    0
    Hate you :angry:

    My answer is more accurate though ^^