Sizes of Memory Leaks

Leo

New Member
Reaction score
14
I was curious, and after a brief search I didn't see any threads addressing this, but has anyone done any research to figure out how big various memory leaks actually are.

For example, how big is the leak created with a hundred unit unit group vs. a 10 unit unit group. Or how much memory does a point memory leak waste - a couple kb maybe?

On a related leak topic, I opened up an old map of mine, done before I knew what leaks were and I let it run, I then watched my computers memory usage in the windows task manager. Memory use went up and up (no surprise), but I was more surprised by the fact that the memory went up almost at constant pace every couple seconds, while the leaky triggers (spawning large numbers of units at center of regions) were only running like every minute or so. There also didn't seem to be big jumps in memory usage when the units spawned. I just thought this seemed odd, or maybe I just didnt pay very good attention. Just curious what others might think.
 
K

Kevin

Guest
i have a question, how do I discover if my map has memory leakage? o!^_^!o
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Well, I'm sure someone will show up here with completely made up numbers, or values they "know", as seen from the task manager.

Anyway, in the end, make sure to clean leaks on things that run often.
Like "pick every unit in playable map" every 0.01 seconds.
Or just about anything related to triggered abilities.


As for the actual size... difficult to say.
A "handle" is a 32bit integer.
As such, it uses 4 bytes.

Now, what exactly makes up a "unit" for example?
The handle to the unit of course.
And, after that?
Units have a model, a skin, an owner, a level, health, mana, abilities, with levels, ... who knows what exactly is stored there?


Then again, continuously running a trigger that creates a local integer array will eat up 32K on every run...
All the fun really.


Well, there's a reason why looking at the task manager doesn't make for decent results.
Memory management doesn't just work like that.
Even memory that is freed (clean up the leaks) isn't instantly reclaimed by the system.
Programs ask for memory as needed.
They also free it as needed. Or as the system sees fit. Which might be immediately after freeing it. Which might be 5 minutes later.

On a leak free map, memory usage will go up constantly.
Up to some limit.
Once that limit is reached, usage will remain stable.
Very high maybe, but stable nonetheless.


And, just for the record, I know a famous TD map that has a confirmed 8000 position leaks, and runs just fine.


If the game slows down the more you play it, you have a memory leak. (Well, several actually)
If the game takes forever to exit, you have a memory leak. (Well, several actually)
 

SFilip

Gone but not forgotten
Reaction score
634
Well answering this question is rather difficult, but I'll give my best. Of course know that most of the stuff I'll write might not be true.
In general, knowing today's memory standards, memory leaks are so minor that one doesn't even get registered by the task manager.
The only thing known is that every handle (handle=every variable type except for boolean, string, integer and real) takes 32 bytes. So creating a point technically takes that much.
If you create one every 0.01 seconds after an hour you will waste roughly 11mb which isn't a lot compared to today's memory standards so you can probably live with this leak.
Unit groups, on the other hand, seem to have a different method. My own theory is that they take 32 bytes + 8 for every unit they hold.
This is, however, hard to believe but terrifying if it is true - with picking just 100 units every 0.1 seconds you would waste 28.5mb after an hour.
Special effects seem to leak insanely high amounts. In one testing I created around 100-500 and it leaked 25+mb so you get the conclusion out of it...
Regardless of any of this being true or false memory leaks are very bad and they will slow your map or even cause server splits if you indeed have too many. Remove them always, especially in triggers that happen periodically.

> how do I discover if my map has memory leakage?
Read a tutorial and first figure out what a memory leak is...after that you will know...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top