• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] [GUI] Need help to fix memory leaks

Level 2
Joined
Jul 1, 2023
Messages
7
:fp: Map Download
i don't know what function is leaked so can u take a look for me :cry:
if you think it's not worth the time then let me hire you(Anyway, I don't have a lot of money.)
but i hope it can fixed by GUI
 
Last edited:
Level 2
Joined
Jul 1, 2023
Messages
7
You can, should, and eventually will have to learn how to do this yourself. Here is the best resource for learning: Things That Leak

You should not pay someone real money to fix leaks in your map; the skill is incredibly important and you will always have to be doing it.
i already did it everything
but i don't know is this function is blacklisted too?
if yes so what i need to use instead

Set Unit_Group[1] = (Units within 300.00 of Unit_Point[1] matching ...)
Unit Group - Pick every unit in Unit_Group[1] and do (Actions)
Loop - Actions

Unit Group - Remove all units from Unit_Group[1]
Custom script: call DestroyGroup(udg_Unit_Group[1])
Custom script: set udg_Unit_Group[1] = null
 
Level 39
Joined
Feb 27, 2007
Messages
5,037
For your own future reference:
but i don't know is this function is blacklisted too?
I don't know what you mean by this. Which function? In the example trigger you showed you are doing everything correctly and will not leak anything. In fact, you are actually doing too much that you don't need to do.
  • Remove all units from unit group is not necessary; the group does not have to be empty when it's destroyed. (Nothing will leak because of that.)
  • Setting the variable = null is usuallynot needed because the variable is a global variable that will just get (re)assigned to something else eventually anyway.
    • You would need to do this for any variables that are local variables rather than globals, since those will never be used again after the end of the function where they cease to exist any more. Not nulling such variables is a "reference leak" rather than a "memory leak"; the object was destroyed properly but a variable still points to the destroyed object.

    • Any global variables that are made to function like local variables within a trigger/function will also need to be nulled before the end of the function where they cease to exist. This is sort of an advanced technique so you probably won't be using it, but just know that if you ever do use locally-shadowed globals you'll have to be careful about leaks with them.
 
Top