Null and Leaks

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
The leaks are basically the same as your GUI leaks (locations, groups etc).

You have to null local variables "pointing" to certain handles. Take units for example; say you create some dummy unit in a local unit variable and adds an expiration timer, the variable will still point towards this unit. Locations are also an example.

Most of these are usually easily avoided by the vast variety of systems available to help making life easier. Any use of local locations can be prevented with a global map-specific location variable that you move whenever needed, other than that usage of real values removes the need to worry about locations.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
This I am certain of:

Needs to be destroyed:
  • locations
  • rects
  • unit groups
  • player forces
  • effects
  • timers
  • user created triggers

Needs to be nulled:
  • locations
  • rects
  • unit groups
  • player forces
  • effects
  • units
  • timers
  • user created triggers

When something is permanent (like players, triggers, recycled timers or even a caster system's caster), you don't need to null it
 

Sevion

The DIY Ninja
Reaction score
413
JASS:
type agent			    extends     handle // If they extend this, they leak and must be destroyed (with exceptions)

type event              extends     agent  // Events never need to be destroyed unless you need to... but... no one needs to...

type player             extends     agent  // Players, don't destroy them. Just null pointers

type widget             extends     agent  // Also just null

type unit               extends     widget  // Null

type destructable       extends     widget // Null

type item               extends     widget // Null

type ability            extends     agent // Who uses abilities? Null

type buff               extends     ability // In essence, the same as an ability

type force              extends     agent // Destroy and null. Don't use them though, use player arrays!

type group              extends     agent // Destroy and null. Don't use them though, use unit arrays!

type trigger            extends     agent // Destroy and null

type triggercondition   extends     agent // Destroy and null

type triggeraction      extends     handle // Destroy and null

type timer              extends     agent// Destroy and null

type location           extends     agent // Remove and null

type region             extends     agent // Destroy and null

type rect               extends     agent // Destroy and null

type boolexpr           extends     agent // Recycle! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />

type sound              extends     agent // Destroy and Null

type conditionfunc      extends     boolexpr // Recycle! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />

type filterfunc         extends     boolexpr // Recycle! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />

type unitpool           extends     handle

type itempool           extends     handle

type race               extends     handle

type alliancetype       extends     handle

type racepreference     extends     handle

type gamestate          extends     handle

type igamestate         extends     gamestate

type fgamestate         extends     gamestate

type playerstate        extends     handle

type playerscore        extends     handle

type playergameresult   extends     handle

type unitstate          extends     handle

type aidifficulty       extends     handle



type eventid            extends     handle

type gameevent          extends     eventid

type playerevent        extends     eventid

type playerunitevent    extends     eventid

type unitevent          extends     eventid

type limitop            extends     eventid

type widgetevent        extends     eventid

type dialogevent        extends     eventid

type unittype           extends     handle



type gamespeed          extends     handle

type gamedifficulty     extends     handle

type gametype           extends     handle

type mapflag            extends     handle

type mapvisibility      extends     handle

type mapsetting         extends     handle

type mapdensity         extends     handle

type mapcontrol         extends     handle

type playerslotstate    extends     handle

type volumegroup        extends     handle

type camerafield        extends     handle

type camerasetup        extends     handle

type playercolor        extends     handle

type placement          extends     handle

type startlocprio       extends     handle

type raritycontrol      extends     handle

type blendmode          extends     handle

type texmapflags        extends     handle

type effect             extends     agent // Destroy and null

type effecttype         extends     handle

type weathereffect      extends     handle

type terraindeformation extends     handle

type fogstate           extends     handle

type fogmodifier        extends     agent // Destroy and null

type dialog             extends     agent // Destroy and null or recycle!

type button             extends     agent // Destroy and null or recycle!

type quest              extends     agent // Destroy and null

type questitem          extends     agent // Destroy and null

type defeatcondition    extends     agent // Destroy and null? Perhaps recycle? I have never used these

type timerdialog        extends     agent // Destroy and null, could recycle, I bet.

type leaderboard        extends     agent // Destroy and null, or recycle!

type multiboard         extends     agent // Destroy and null, or recycle!

type multiboarditem     extends     agent // Destroy and null, or recycle!

type trackable          extends     agent // There is no destroy <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown    :(" loading="lazy" data-shortname=":(" /> Only can disable their trigger and null the pointers. Unfinished types ftl.

type gamecache          extends     agent // Meh!? You use GC?!?

type version            extends     handle

type itemtype           extends     handle

type texttag            extends     handle

type attacktype         extends     handle

type damagetype         extends     handle

type weapontype         extends     handle

type soundtype          extends     handle

type lightning          extends     handle

type pathingtype        extends     handle

type image              extends     handle

type ubersplat          extends     handle

type hashtable          extends     agent // Recycle. Never destroy these.


Anything that extends agent, generally.
 

Chaos_Knight

New Member
Reaction score
39
This I am certain of:

Needs to be destroyed:
  • locations
  • rects
  • unit groups
  • player forces
  • effects
  • timers
  • user created triggers

Needs to be nulled:
  • locations
  • rects
  • unit groups
  • player forces
  • effects
  • units
  • timers
  • user created triggers

When something is permanent (like players, triggers, recycled timers or even a caster system's caster), you don't need to null it

Thanks, bot you and Sevion. +rep. ;)
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Don't need to null players
If you use TimerUtils, you also don't need to null timers
 

Viikuna

No Marlo no game.
Reaction score
265
Actually:

locations - you only really need a one location, for GetLocationZ

unit groups - recycle them. no need to null.


timers - recycle. so no need to null

edit.

You basicly have to destroy all [lJASS]handle[/lJASS] objects, that you no longer have any use for.
If you destroy some [lJASS]handle agent[/lJASS] object, you also have to null all variables pointing to it. If there is some variables pointing to it, its handle index wont get recycled.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top