• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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)
 
Level 8
Joined
Aug 4, 2008
Messages
279
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.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
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.
 
Level 9
Joined
Jul 3, 2008
Messages
495
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
 
Level 8
Joined
Aug 4, 2008
Messages
279
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
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
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.
Top