Yet another leak question

Lahey

New Member
Reaction score
1
Does this leak?

Set Point1 = (Center of region1 <gen>)
*goes in loop*
Item - Move (Picked item) to Point1 *an then like 20 times this move action*
Custom script: call RemoveLocation (udg_Point1)

If this doesn't leak then I don't really see the point in removing the location. Because the variable is already there from the beginning of the game and it's value will only be replaced by another value when it's set.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, as long as you donät set it to another value before destroying it, or use any waits it won't leak ;)
 

Lahey

New Member
Reaction score
1
Ok.

Now what does the script remove? The value of the variable? That would be silly. Or does it delete some garbage code? If so, when is this garbage code created? When the variable is set or when it is used?
 

Yizzy

New Member
Reaction score
20
It removes the allocation of the memory

"Typically, a memory leak occurs because dynamically allocated memory has become unreachable." - Memory leaks - en.wikipedia

I'm not sure when the leak occurs, as I don't know how Jass allocates variables. My guess would be that a point variable is a pointer to a loc object (struct) which is not freed when assigning the pointer to a new value, thus creating a memory leak. It may seem stupid but probably Jass wasen't invented to create a base for GUI..;) as memory allocation and freeing (destorying) was intended to be done by user (in jass).. which is why you should use Custom script: call RemoveLocation (udg_Point1).. :thup:
 
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