[Trigger] Memory Leak? Yes? No?

Status
Not open for further replies.
Level 7
Joined
Jul 19, 2008
Messages
58
Just wondering but is this a memory leak?


  • Events
  • Conditions
  • Actions
  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Wait 2.00 seconds
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
 
Yeah, because of the degrees, try this:
Set point = (Random Point in Region) offset by 0 towards 270 degrees)
Unit - Create 1 Wisp at point.
Wait 2 seconds
Unit - Create 1 Wisp at point
Custom Script : call RemoveLocation (udg_point)

@Edit:Oh, my bad, this wont work, sry, hehe.No theres no leaks there.
 
That trigger leaks if it is executed more than 1 time in 2 seconds.

  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
  • Wait 2.00 seconds
  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
This is better though its maybe not what have you wanted.
 
If this tirgger runs only one time it will leak. If it does you need to nullfy the
variable. Simply do this:

  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
  • Wait 2.00 seconds
  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
  • Custom Script: set udg_point = null
 
I Dont think it needs to be nullfy...
gameslayer001, u dont need to do that unless u want to do the trigger within 2 secs.
if u want, you can simple do for Integer A
For each integer A from 1 to (how many wisps you want)
set point = random point in region
create wisp at point facing 270
call removelocation(udg_point)
wait 2 secs
 
If this tirgger runs only one time it will leak. If it does you need to nullfy the
variable. Simply do this:

  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
  • Wait 2.00 seconds
  • Set point = Random Point in Region
  • Unit - Create 1 Wisp At point Facing 270 degrees
  • Custom Script: call RemoveLocation(udg_point)
  • Custom Script: set udg_point = null

Global variables don't need to be nullified as they don't leak pointers.
 
Status
Not open for further replies.
Back
Top