• 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] Can Someone Explain To Me What Is Leak??

Status
Not open for further replies.
Level 4
Joined
Jul 24, 2008
Messages
108
Let me put it into noncomputer terms

You go to the store to buy food.
You eat the food, however you don't throw away the left overs,
Next day, same thing.
Now repeat several hundred times.
Your house is a mess, and eventually it will be so cluttered with stuff not being used anymore your mom will go apeshit (or wc3 lags/splits)


How did i do?

Same with wc3 not destroying variables and other things causes the memory to get all cluttered and run out of room for other important stuff which causes lag

simple fix, after you are done using something destroy it (cleaning up), by using call RemoveLocation (udg_name) or other thigns like that.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
No.

If it's a global (if it would be a local you would know it is a local), you do not need to do anything about it.

If it is a local, you need to null it.

As to destroying things - groups, locations, and effects are NOT variables. They "point" (read about pointers here) to an object which probably contains coordinates x and y for location, x, y and a string for an effect, and an array of units for a group.

Any how, since you probably didn't get most of what I just said - when you declare a location, effect, or a unit group, you actually declare two things: a variable (pointer) and an object.

Now as we said, if the variable is global, you do not need to do anything about it. But the object is a whole other subject.
You must destroy that object once you have done using it or else it will just stay in the memory and make your game lag in case of heavy leaking.

You remove locations with this script:
  • Custom script: call RemoveLocation(variable name)
Groups with this script:
  • Custom script: call DestroyGroup(variable name)
And finally effects with:
  • Custom script: call DestroyEffect(variable name)
Remember that if you are using globals, there is always "udg_" before the variable name, so if you declared a point variable called "Point1", you will remove it with this script:
  • Custom script: call RemoveLocation(udg_Point1)
 
Status
Not open for further replies.
Top