• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[General] Memory Leaks

Status
Not open for further replies.
Level 1
Joined
May 20, 2015
Messages
2
Will this trigger create any memory leaks?

Event:
Time elapsed is 2.00 seconds

Actions:
Set Quickpoint: Position of Hero
Create destructible at Quickpoint
Set Quickpoint: Position of Enemy
Create destructible at Quickpoint
Custom script: call RemoveLocation (udg_QuickPoint)

Thanks in advance
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
yes, 1 location is leaked forever.

This is because when you do "Position of X", the game basically creates new location, so it reserves a bit of memory and puts the contents in there.

Then you do it again, but you stop pointing your finger to the old bit of reserved memory, and start pointing to the new one.

Then you cann RemoveLocation, so the game looks at your finger, looks where it is pointing at, and goes and demolishes(unreserves) that bit of memory. But as you can see, the first one cant be demolished, because there is nothing pointing fingers at it.

Basically, you have to call RemoveLocation before "Set ... to Position of X"
 
Status
Not open for further replies.
Top