HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Quick Memory Leak Question

08-09-2007, 06:13 AM#1
Kirym
If your creating a custom made spell that say, is based off blink, and does another effect through triggers at the point of casting. If you have created a seperate variable as a point, if you do not remove this region as you are supposed to, will you still have memory leaks. If you don't understand my bad writing (sorry i'm up later than usual), here is an example:

Variables used:
ASDF (A Point)

Trigger:
Untitled Trigger 001
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Blink
Collapse Actions
Set ASDF = (Position of (Triggering unit))
Unit - Create 1 Footman for Player 1 (Red) at ASDF facing Default building facing degrees

In other words, does the holding of the point in this variable cause memory leak.
08-09-2007, 06:18 AM#2
Nubcookie
Well, if you assign ASDF to another point without deleting it first, then it will "leak". But if you keep spawning footies at that same ASDF point the until game it isn't considered a "leak". It is saved in memory though.
08-09-2007, 07:12 AM#3
Rising_Dusk
In your case, you would leak a location every cast.
You'd need to add the line --

Trigger:
Custom Script - call RemoveLocation(udg_ASDF)
To the end of your actions list.
08-09-2007, 08:16 AM#4
Anitarf
Also, the "begins casting a spell" event is abusable. Players can order the spell to be cast and then press stop before it actualy casts to get the triggered effects of the spell without paying the manacost and starting the cooldown. You should use "starts the effect of an ability" instead.
08-09-2007, 02:49 PM#5
Kirym
Thanks for the answer, I read the two tutorials about memory leaks in the tutorials section and was unsure as to if it would leak or not. The reason i was unsure was because in both they used a variable involving some form of "temp" so i didn't know if there were pre-existing variables generated by the game i didn't know about, or if it was a variable trigger set up by the map creator. This clears thing up, and yes I'm aware of the ability its abusable, i just needed something to quickly test the ability.

I also have another question.... basically, as long as you are using a variable for longer than a few seconds, its not a memory leak?

This also kind of fits in with my second question. Say i'm making a TD or a Hero Survival, and i want to use a unitgroup to keep track of all the units in those lanes (lets say i have 4 lanes and use a unit-group array), do the dead units contribute to memory leak?