How do PocketMine handle variable? For example if i assign $data in function for a freaking long string that take 3mb of RAM, will it automatically free up when i leave that function? Or i have to unset($data) or assign $data = null ?
Of course it does unset variables that are on function scope PHP: <?phpfunction bla(){$string = "BLABLABLABLABLABLA";}bla();//No memory leak here
If the variable isn't being used anymore, the garbage collector will free the associated memory. Using unset() will not immediately remove the variable from memory, but will mark the memory associated with the variable to be freed when the garbage collector runs. Seting the variable to null will overwrite the data immediately, freeing the previous memory.