A question about leaks

afisakov

You can change this now in User CP.
Reaction score
37
Do players leak in Jass?
if I write
Code:
function addpspecial takes player p returns nothing
does this use "p" as a local variable, and does it have to be somehow removed or does it not leak as is?

I ask because I read somewhere that players and units do not leak in gui, only groups of them, however I do not know if this applies to Jass. Also, I am not familiar with local variable and any special rules related to them.
 

dracolich

TH.net Regular
Reaction score
15
Passed in function data will be destroyed once function is completed. No need to nullify transfered handle.
 

cyb3rhack-r

New Member
Reaction score
0
First of all, player does not leak. Second, anything that a function takes is nulled or destroyed through the function that called it. For example, function A is the parent function calling function a as a child function. If function a takes location aka call a( myloc ), myloc will be a variable written from function A and therefore must be destroyed and nulled there.
 

afisakov

You can change this now in User CP.
Reaction score
37
For example, function A is the parent function calling function a as a child function. If function a takes location aka call a( myloc ), myloc will be a variable written from function A and therefore must be destroyed and nulled there.
Does that meanI can't fix leaks in child function :(

I was hoping to write a function to create x units of type y at location z using a loop and put all the leak cleanup into it so I could spawn a group at a spot with one line. Guess that won't work?


Another question, can I safely fix group leaks with
Code:
call DestroyGroup(GetLastCreatedGroup())
assuming there are no waits in between of course?
 
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