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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top