MLeaks in unit creation

dracolich

TH.net Regular
Reaction score
15
MemoryLeaks in unit creation

Well, i have a point, where will spawn units only once.
I have a var for this point, and question is:
Should i remove and recreate var every single unit spawn, or I can destroy it only once at end of trigger, when all units will be create?
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
Use coordinates (reals) for this, so you don't have to null the point.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
and to answer your question you can destryo it at the end. you dont have to redefine it for every usage if its still the same point.
 

Bribe

vJass errors are legion
Reaction score
67
To know whether something leaks, you should be looking at the JASS script. When something takes nothing and returns a handle-based object, and is not a BJ function, you can be 99% sure that it allocated memory and will need to be removed somehow.

If you have a variable set to that returned value, that variable is not re-created each time it is referenced; it is just a reference to the already-created object.

10,000 references to a point will not leak any more than 1 reference to it.

That said, if you re-set the variable to a different position, you need to remove it before re-setting it. Alternatively, there is a native called MoveLocation which is only found in JASS.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top