JALQ(just another leak question)

Status
Not open for further replies.
  • Unit - Create 1 Footman for Player 1 (Red) at ((Center of (Playable map area)) offset by (0.00, 0.00)) facing Default building facing degrees
JASS:
function OffsetLocation takes location loc, real dx, real dy returns location
    return Location(GetLocationX(loc) + dx, GetLocationY(loc) + dy)
endfunction
As you can see this function will return location so it will leak if you don't remove it later.

I suggest this:
  • Custom script: call CreateDestructable(objectid, x, y, facing, scale, variation)
scale by default = 1.00
variation by default = 0
 
creating something will always leak but not the position itself using Xy coordinates...

Sorry but what you are saying doesn't make sense.

Technically a leak it's when there is some memory hold, when it's no more necessary.
But it's not because you create something that it will create a leak, ofc it will take some memory but it's intended.
Now when the object is not destroyed when it's no more used, or if there is still some memory hold by it when it has been destroyed, then it's a leak.
 
That would (genearlly) be very inefficient. If you intend to re-use data, there are much better ways, for example:

JASS:
globals
    location point=Location(0,0)
endglobals

and later when you need a location:

call MoveLocation(point,newX,newY)

then refer to point again.

Similarly, you can re-use a group if it never retains contents.
 
Status
Not open for further replies.
Back
Top