• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Memory Leak Trigger

Status
Not open for further replies.
Level 3
Joined
May 18, 2009
Messages
33
I need help cleaning up the memory leaks in one of my triggers.

help.jpg

Any ideas?
 
It is better to right click the trigger, copy as text, and place them between [TRIGGER][/TRIGGER] tags. It'll be easier for us to read and respond.

Anyway, the leaks come from the "Position of..." functions. Those are leaking points. To fix it, create two variables:
  • Set SurvivorPoint = (Position of Survivor[(Integer A)])
  • Set SeekerPoint = (Position of The Seeker 0012 <gen>)
  • Hero - Modify strength of Survivor[(Integer A)]: Set to (Distance between SurvivorPoint and SeekerPoint)
  • Custom script: call RemoveLocation(udg_SurvivorPoint)
  • Custom script: call RemoveLocation(udg_SeekerPoint)
Check out some of the tutorials on leaks on this site and world-editor-tutorials.thehelper.net. If you familiarize yourself with leaks, you'll have a much nicer time coding without worrying about chewing up memory.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Changing IntegerA for your own variable does not prevent leaks, but it's more efficient and generally better for various reasons.

Leaks are where you modify hero's strength. The (position of *something*) leaks. Look at post #5 - purge already wrote how to solve the problem.
 
Level 3
Joined
May 18, 2009
Messages
33
Changing IntegerA for your own variable does not prevent leaks, but it's more efficient and generally better for various reasons.

Leaks are where you modify hero's strength. The (position of *something*) leaks. Look at post #5 - purge already wrote how to solve the problem.

I incorporated #5 into the trigger, works fine. Its the Integer A variable that I tried making that didn't work.
 
Status
Not open for further replies.
Top