Remixer is correct but I just wanted to add 1 little clarification, you don't need to reference Coordinates in GUI to prevent the leak with the Point A example. You can simply do this:
-
Set Variable PointA = (Center of playable map area)
-
Unit - Move (YourUnit) to PointA
-
Custom script: call RemoveLocation(udg_PointA)
That will clean up the memory leak.
Here's the code for getting the center of a Region. It's a little confusing because Blizzard used different terminology in their code:
vJASS:
function GetRectCenter takes rect whichRect returns location
return Location(GetRectCenterX(whichRect), GetRectCenterY(whichRect))
endfunction
Rect =
Region (basically, it's a little more complex than that but don't worry about it yet)
Location =
Point
GetRectCenter is the name of the function. It's basically an Action but in code form. It requires that you give a Region (
whichRect) when trying to use the function. By doing this it will create a new Point variable (
Location) which is positioned at the center x coordinate (
GetRectCenterX) and center y coordinate (
GetRectCenterY) of the given Region. It then returns that Point variable to whatever function (Event/Condition/Action) that was trying to get the center of the Region. In other words, it Sets a Point variable for you and then gives it to you for your own use.
However, there's an issue here. The Point (Location) variable that it creates for you never gets destroyed, therefore it will exist in the game's memory taking up space for no good reason. That's where you step in and use a Point variable yourself to intercept the returned data. You're basically telling the
GetRectCenter() function that you want to keep track of the Point, this way you can Remove it when you're done with it.
Note: I believe (Entire map) leaks so maybe don't use that one. You can always create your own Region that encompasses the "entire map" to avoid this issue.
Ok, thanks. I will keep it in my mind. I was actually searching for this
https://mbaessayhelp.com/mba-thesis-topics / website online because I am looking for the MBA thesis topics regarding my work and while searching for it online, I found your post.