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 havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,530
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    only thing is its not that much extra effort to null the variables so y not do it lol. i can understand its not worth going over every one of ur old triggers to do it but when making new ones y not.
     
  2. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    I never tell people to null globals. I never did and I never will :p
    Only local agents should be nulled at least. You can play it safe and null local handles too of course, but they're not reference counted, so it's not needed really~
     
  3. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,426
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Well, there is a tradeoff for everything. Remember that for every extra character in your code, you are adding a slight boost to the file size and a slight speed decrease. Of course, this is all on a microscopic level, but so is the RAM "leak".

    The main reason why we null locals is because it will allow the handle ID to be recycled. Since that problem doesn't exist with globals, we don't have to really worry about it.

    You can still null globals if you want to, but it is more of a matter of personal preference.
     
  4. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    I never got to comment when I first read this tutorial but I mus say this is very helpful for beginners (like I was in the days before)... this will be helpful to a lot of people =)

    @Magtheridon96's earlier post: what happens when someone nulls Globals?
     
  5. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    nothing special, it just nullifies the memory variable is pointing to(the value stored in variable) so if you call some functions which take that type and you pass global, it will not do anything

    Be aware that nullying(I dont know about the y tho) is not the same as destroying the handles
     
  6. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    I never knew that info about Globals until now, but I sure know the difference between nulling a handle and destroying it.

    Thanks for answering me =)
     
  7. mikagami

    mikagami

    Joined:
    Aug 9, 2012
    Messages:
    112
    Resources:
    0
    Resources:
    0
    Great !! Very helpful
     
  8. Losam

    Losam

    Joined:
    Mar 27, 2011
    Messages:
    259
    Resources:
    8
    Spells:
    8
    Resources:
    8
    Help

    What this best way to:

    • Create random unit groups.
    • MUI/Loop Spells (for GUI's Users).
    • Create Channel's Spells.
     
  9. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    If you want to make MUI spells, there are some tutorials here on Hive.
     
  10. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,530
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    u should also create one group for spell. as creating it every iteration is very inefficient.
    u also wont have to destroy it anymore.
     
  11. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    So store units created in the spell in a group var?
     
  12. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    yes, the enumeration is bit heavy operation, but create/destroy unit group is lot more heavy, if you create, fill,, itterate, destroy group every .01 sec it may and most likely will start dropping fps just because of how heavy the create destroy combo is

    you can just add units to the unit group when spell is cast and remove them when the effect of the spell has ended for them, then when the group is empty you should turn off the trigger to prevent useless iterations, but you most likely know that already
     
  13. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    bj_lastCreatedGroup can be used for instant itineration, so no need to create one group, this usually works but 'might' have problems if someone saved that group then destroys it...
     
  14. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    bj_lastCreatedGroup is
    • Unit Group - Last Created Unit Group
    right?
     
  15. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    bj_lastCreatedGroup is used inside that trigger but it's not that...
     
  16. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    Oh I see; thanks for the info :D
     
  17. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Not quite:

     
  18. caleman

    caleman

    Joined:
    Jul 21, 2011
    Messages:
    139
    Resources:
    0
    Resources:
    0
    please upload a map with a spell example, im interesed
     
  19. ScorpioT1000

    ScorpioT1000

    Joined:
    Jun 26, 2013
    Messages:
    34
    Resources:
    0
    Resources:
    0
  20. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,685
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Sadly that snippet don't compatible with all Vex Jass and thus can't be recommended here.