• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Things that Leak within another variable

Status
Not open for further replies.
Level 7
Joined
Jun 19, 2017
Messages
144
I was wondering if things that leak, are also leaking if they are used within another variable, like in this case. Does the point within the unit group variable leak ?
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    20 KB · Views: 100
Level 16
Joined
Mar 25, 2016
Messages
1,327
point = location
region = rect

A leak doesn't occure just because you use a variable of a certain type like a point or unit group.
A leak occurs if:
1.you create an object
2.you don't remove the object
3.you lose reference to the object, so you can no longer remove it

playable map area is created at the beginning of the map and you never lose reference to it, so it does not leak.
If you would create a region dynamically for example with convert coordinates to region like here:
  • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Region(-50.00, -50.00, 50.00, 50.00))
it would leak, so you would need to store the region in a variable and use a custom script to remove that region

A dynamically created object is created at some point in the game, in most cases they should be removed at some point as well.
objects can also be created at map initialization. In that case they are only created once and are often needed for the rest of the game, so they don't need to be removed.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
I was wondering if things that leak, are also leaking if they are used within another variable, like in this case. Does the point within the unit group variable leak ?
What you are asking makes no sense. Please look at the underlying JASS code GUI compiles into, things make a lot more sense then.

WC3 mostly lacks automatic garbage collection. Every object you allocate must be destroyed.
 
Status
Not open for further replies.
Top