• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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