Memory Leak Issues?

futeki

Active Member
Reaction score
4
Are there any memory leak issues with resetting variables over and over again?

I'm constantly changing variables, or zeroing them out. I've been searching the forum and can't seem to find anywhere anyone has addressed this...
 

Ayanami

칼리
Reaction score
288
Well, depends on the variable. If the variables don't leak (real, integer, etc), then there isn't a problem. However, for variables like point, unit group, etc. there is a problem if you don't remove the leak before resetting the value. For example.

Leaks:
Trigger:
  • Actions
    • Set TempPoint = (Position of MyUnit)
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Set TempPoint = (Position of MyOtherUnit) <-- Leaks here


Does not leak:
Trigger:
  • Actions
    • Set TempPoint = (Position of MyUnit)
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Set TempPoint = (Position of MyOtherUnit)
    • Custom script: call RemoveLocation(udg_TempPoint)
 

Moridin

Snow Leopard
Reaction score
144
Glenphir...your first trigger doesn't leak either :S.

You have to set the point again after the second time, thus nudging the old data into backlog. If you don't ever use that point again, it doesn't leak :S.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
depends on what you define as a memory leak, any usage of memory or just the unrecoverable loss of memory. as it seems glenphir uses the first definition given.
 

futeki

Active Member
Reaction score
4
Well, depends on the variable. If the variables don't leak (real, integer, etc), then there isn't a problem. However, for variables like point, unit group, etc. there is a problem if you don't remove the leak before resetting the value.

What about strings? I'm constantly changing strings for use later on...
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
there are only some variable types which leak memory, these are "locations", "unit groups", "forces", "rects", "special effects", "floating text", etc etc.

basic classes like integers, reals, strings, booleans and such do not leak. neither do units, players, items, and such.
 

futeki

Active Member
Reaction score
4
there are only some variable types which leak memory, these are "locations", "unit groups", "forces", "rects", "special effects", "floating text", etc etc.

basic classes like integers, reals, strings, booleans and such do not leak. neither do units, players, items, and such.

So, does that include integer and string arrays?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
integer or integer arrays do not make any difference for leaks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top