Triggers - Memory Leaks and Custom Scripts

tooltiperror

Super Moderator
Reaction score
231
Animations don`t leak, neither do any strings.

Also, they need to add JASS to this, really.
 

Zanderist

New Member
Reaction score
5
Yes but how was it discovered?

Did someone find them in blizzard's maps?

Did someone from blizzard put a list out?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
blizzard.j, common.j and iirc a 3rd one, though I don't remember the name...

There is common.ai but those functions aren't accessible unless you have NewGen and use native declarations. They don't have handle destroying functions though, so yeah. :p

Anyway, as said they were found in the common.j and blizzard.j. Except they ultimately end up calling from the common.j, and the standard custom-script-handle-destroying functions for GUI are from the common.j.

Here are a lot of them, probably not all but I was too lazy to look through them all. However, you only need to really use a couple of these except for in specific occasions:
JASS:
native DestroyDefeatCondition           takes defeatcondition whichCondition returns nothing
native DestroyEffect                takes effect whichEffect returns nothing
native DestroyFilter    takes filterfunc f returns nothing
native DestroyFogModifier           takes fogmodifier whichFogModifier returns nothing
native DestroyForce             takes force whichForce returns nothing
native DestroyGroup                         takes group whichGroup returns nothing
native DestroyImage                 takes image whichImage returns nothing
native DestroyItemPool          takes itempool whichItemPool returns nothing
native DestroyLeaderboard               takes leaderboard lb returns nothing
native DestroyLightning             takes lightning whichBolt returns boolean
native DestroyMultiboard                takes multiboard lb returns nothing
native DestroyQuest         takes quest whichQuest returns nothing
native DestroyTextTag               takes texttag t returns nothing
native DestroyTimer         takes timer whichTimer returns nothing
native DestroyTimerDialog               takes timerdialog whichDialog returns nothing
native DestroyTrigger   takes trigger whichTrigger returns nothing
native DestroyUbersplat             takes ubersplat whichSplat returns nothing
native DestroyUnitPool          takes unitpool whichPool returns nothing
native DialogDestroy                takes dialog whichDialog returns nothing
native TriggerRemoveAction  takes trigger whichTrigger, triggeraction whichAction returns nothing
native TriggerRemoveCondition takes trigger whichTrigger, triggercondition whichCondition returns nothing
native RemoveLocation           takes location whichLocation returns nothing
native RemoveRect               takes rect whichRect returns nothing
native RemoveRegion             takes region whichRegion returns nothing


You can view the common.j functions with something like JASSCraft or TESH found in NewGen. They basically have function finders which allow you to find which function you need to use.
 

SanKakU

Member
Reaction score
21
when I use call RemoveLocation (udg_Temp_Point) It won't work it gives an error :(

Line 28: Invalid argument type (rect)
Line 31: Expected a code statement (rect)

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
set udg_Temp_Point = gg_rct_Region_Start
call CreateNUnitsAtLocFacingLocBJ( 1, 'nspr', Player(11), GetRandomLocInRect(udg_Temp_Point), GetUnitLoc(GetTriggerUnit()) )
call RemoveLocation (udg_Temp_Point)
endfunction


I didn't use jass it just gave me that :)

i think this is a very late reply...sorry about that.
anyway...you're confusing points and rects.
a point is something in gui that uses x and y reals.
in other words...you're trying to set your point to be a region, or a rect.
but that's not allowed at all.
0,0 is an example of a point.
0,0,100,100 would be an example of a region.
you can't make a point into a region, you are going to at least need two points to make a region.
 

Kiido

New Member
Reaction score
2
Quick question,

Does using GUI to "Remove (unit) from the game" effectively stop the leak? Or is a custom script needed?
 

Arnaldium

New Member
Reaction score
0
I'm sorry to bump this but I have a question that has been bothering me.

If I'm using multiple times the same point variable, do I have to set it and free it everytime I use it during a code?

such us:

Trigger:
  • Teoria de Cuerdas Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teoria de Cuerdas
    • Actions
      • Set cuerdM = 50000.00
      • Set cuerda = (Casting unit)
      • Custom script: set bj_wantDestroyGroup=true
      • Set abj_position = (Position of (Triggering unit))
      • Unit Group - Pick every unit in (Units within 600.00 of abj_position matching ((((Owner of (Matching unit)) is an enemy of (Owner of cuerda)) Equal to True) and (((Matching unit) is A Hero) Equal to True))) and do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation (udg_abj_position)
          • Set abj_position = (Position of (Triggering unit))
          • Set acj_position = (Position of (Picked unit))
          • Set cuerdD = (Distance between abj_position and acj_position)
          • Custom script: call RemoveLocation (udg_abj_position)
          • Custom script: call RemoveLocation (udg_acj_position)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • cuerdD Less than cuerdM
            • Then - Actions
              • Set cuerdM = cuerdD
              • Set cuerdeado = (Picked unit)
            • Else - Actions
      • Set abj_position = (Position of (Triggering unit))
      • Unit - Create 1 Envenomer for (Owner of (Triggering unit)) at abj_position facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_abj_position)
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add CuerdasSlow to (Last created unit)
      • Unit - Set level of CuerdasSlow for (Last created unit) to (Level of Teoria de Cuerdas for (Triggering unit))
      • Unit - Order (Last created unit) to Human Sorceress - Slow cuerdeado


everytime I used abj_postition is Position of triggering unit but I wasn't sure if I had or not to free it everytime I use it.
It's kinda messy but you see the point

It picks the closest hero and cast a slow based skill on it. It works fine but I was concerned about the leaks, maybe I'm a bit too paranoid.
 

tooltiperror

Super Moderator
Reaction score
231
You only need to remove the leaks once at the end.
 

Massacre

New Member
Reaction score
0
:nuts::confused::banghead:
What do you mean by call DestroyTrigger( GetTriggeringTrigger() )
And What Is ( GetTriggeringTrigger() ) ??
 

tooltiperror

Super Moderator
Reaction score
231
It's what you put in the custom script action.
 

OST(Norway)

New Member
Reaction score
0
Do unit functions like "Last created unit" leave leaks?

Example A:
Action - Unit Group - Add (Last created unit) to (Temp_Unit_Group)

Example B:
Action - Set Variable - Set (Temp_Unit) equal (Last Created Unit)
Action - Unit Group - Add (Temp_Unit) to (Temp_Unit_Group)
Action - Custom Script - Call .........

Is it ok with Ex A or do I have to follow Ex B? In case B, how will the Custom Script look?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top