• 🏆 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!

What exactly is the downside of memory leaks?

Status
Not open for further replies.
Level 6
Joined
Apr 27, 2006
Messages
186
Alright, I've read tutorials, and now I believe I know exacly how memory leaks are caused, but I still don't see what they do. For example I read somewhere that using this trigger:

Events: Anything (Map Initialization, Unit Starts Effects of an Ability, etc.)
Conditions: Anything
Actions: Pick Every Unit In Playable Map Area and Kill Pick Unit

This causes a memory leak for some reason, but when I used this trigger all of the units on the map died. Finally to finnish my question, your supposed to use custom script to "clean up" actions (like you set a location and once your done using it you clear/remove it with custom script), what exactly happens if you don't do this?
 
Level 6
Joined
Apr 27, 2006
Messages
186
Oh... So it just makes the game laggier, thx for the reply. Hmm... It's weird, I have a map with over a hundred of "memory leakable" abilities, but the gameplay isn't laggy... I'm guessing the effect of memory leaks isn't too great?

Also, so if I just create a special effect by itslef made out of the war stomp animation, and I don't delete it (because it only plays once), it will create a memory leak? And what about if I just destroy the special effect and don't remove it with custom script?

Ah answer this optionally, but while I'm posting how do you attach lightning effects to flying units? So they aren't flat but instead have one point attached somehwere in the air (basically a Z coordinate), and one point on the ground?
 
special effect has guiversion of jass func, you dont need jass for effect, and yes they will leak if you dont remove them because, they dont display anything but are in your RAM as "object". and not every map with memory leaks will be laggier (it will eventualy if you play it for loooooooooooong time... try playing your map 10 hours and then tell me if it doesnt lag...

you can attach to flying units by using jass function:

set udg_Temploc = (GetUnitLoc(YOUR UNIT)
call AddLightning("YOUR_LIGHTNING_CODE", true, GetLocationX(udg_TempLoc), GetLocationY(udg_Temploc, GetUnitFlyHeight(YOUR UNIT HERE)))
call RemoveLocation(udg_TempPoint)

this is leakless
 
Level 6
Joined
Apr 27, 2006
Messages
186
So if I use the action Special Effect - Destroy specialEffectVariable, then would it leak?!? And for the lightning effect is there a GUI way, I'll use your way but for future reference so I don't have to remember all that JASS :p.

For the lighnting effect code it doesn't make sense to me... I only see one point, the one attached to the flying unit, but where is the other point? And what is "YOUR_LIGHTNING_CODE" exactly? Is that where I put all of my code for the trigger I currently have in GUI?
 
1. use gui to deswtroy special effect so doesnt leak - yes
2. theres no so you can set lighting height
3. U onle see one point, others are coordinates of those pionts. Point consistes of three reals: X,Y and Zm and jass never uses locations in functions, rather points are used. And llight code you will have to explore yourself by converting trigger with "crate lightning" action, so you see code..
 
Level 6
Joined
Apr 27, 2006
Messages
186
It just seems like a lot of trouble for a very small reward. I'd have to make about 130 new variables for my map, and variables are also stored in RAM, so wouldn't that make the game much, much laggier? It's just so many more lines of script; before I had one line of script that did something to units in an area, and now I have three, and that also probably makes the game laggier, is the lag created from these variables extremely miniscule, or am I sort of right?
I just don't want to put a lot of time and effort into something that won't make much of a difference.
 
it will, and your reputation as mapmaker will be high if you get rid of all leaks. someone opens your map and what? "Ow, there are so many leaks! i wan't play this map! Creator was n00b!!11!" and you need only one variable, it's cleared if you use functions to remove them... and it would look as if map is rushed if you dont get rid of leaks... only one variable per variable type, so it doesnt leak.

ps: i suck at explaining things :p
 
Level 6
Joined
Apr 27, 2006
Messages
186
Na ur good at it :p, just one thing, you would need more than one variable for each variable type if the variables were stupopsed to be stored for a certain period of time, i.e, if you want to keep a unit group stored for 15 seconds because something happens after those 15 seconds, you would need an indepent variable for that right?
 
Level 6
Joined
Apr 27, 2006
Messages
186
P.S. I'm going to protect my map so noone can call me a noob > _ <. Heh.
 
Level 4
Joined
Sep 20, 2005
Messages
72
well, another thing i noticed about leaks (especially lots of them created from leaky periodic timers) is that when you leave the game, it leaves the BSOD(i call it the BLACK Screen of Death).
I played an old version of warcraft soccer before (forgot the name of it, fun though btw :thumbs_up: ) n everytime i quit from a game, my computer would come to this blank black screen for like 5 minutes! n u cant do nothin bout it till it finishes, not even alt-f4 or alt tab (that, n the fact that my pc is crap :sad: odd thing is gameplay was never slowed... probably because of the faster pc of nowadays n the somewhat basic triggers) Later when i learned about leaks i realized that it was most likely caused by bijillion location leaks from a periodic timer for moving the ball... after quitting the game the pc is spending time going thru memory to clean the leaks =/

so yea, leaks = bad, annoying, noobish!
 
Level 6
Joined
Apr 27, 2006
Messages
186
Wait... what's the difference from a variable that's assigned and a variable that is deleted, if the ability is used every lets say... 10 seconds, then theres really no point of deleting the variable because it's just going to be used in the future very shortly afterward, right?
 
no, it will stay in memory nontheless, delete italways unless you have to save it for something later (for example in rpgs)

difference is that assigned takes memory and unassigned doesnt take. if you set variable and then dont clean it, and you use that "set variable" again, then it will overwrite current variable data, but wont delete it, variable will be still in memory, so it's STRONLY recommanded to get rid of variables
 
Level 6
Joined
Apr 27, 2006
Messages
186
Ah I see it makes sense now how a map can become very laggy because of leaks, thx again.
 
Status
Not open for further replies.
Top