Do I have to destroy local variables to prevent leaks?

neetmaster

New Member
Reaction score
0
Code:
       set tempforce = GetForceOfPlayer(GetTriggerPlayer())
        call DisplayTextToForce( tempforce, "TRIGSTR_424" )

Does this not leak without calling
Code:
call DestroyForce(tempforce)

the locals are nulled at the end btw

Does calling destroy on local variables prevent them from further uses?
 

Schyy

New Member
Reaction score
5
it is simple ... u can have some variables in the cache the hole game but if there are too much of them it starts to lagg
so u have to destroy variables which arent needed the hole game like variables for a simple trigger

if u only want to display a text to the players at the beginning of the game and dont need the variable anymore in the later game its better to destroy it
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
False. Not destroying & nulling handles will not only cause horrendous lag, but also bug up the map. Also, having code that leaks is frowned upon.
Use both the appropriate destroy-native and set the variable to null, then you're good to go. And yes, if you destroy a force for instance, it will not be able to be used again unless you re-create it.
 

Schyy

New Member
Reaction score
5
it wont laag if u dont have much variables running the hole game ...

it is stupid if u have 2 grps in variables the hole game which u need for example to declare pvp settings and u declare the variables every sec and destroy it after
so u declare at the start of the game and dont destroy or null it
and u can have some of this variables without laaging
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Yes.

Set myForce = ...
Do whatever with it
call DestroyForce(myForce)
set myForce = null (note that this line is only needed on "local" variables, globals do not have that problem)
 
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