HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Memory Leak question...

02-08-2004, 10:50 PM#1
Narwanza
I was playing my TD today and had horrible memory leaks. This really puzzled me because I have played it by myself and found that it had none, or so i thought. My best guess is that the projectiles from the towers are causing memory leaks. Does anyone know how to fix this? Am I going to have to make a ton of melee towers to cut back on lag? It isn't lag with the spawning or the movement locations, nor the locations of the rotating heros becuase first off I destroyed them, and second when I play alone, it doesn't leak. So it must be the added projectiles of more players. I am going to get rid of all .01 cooldown towers, because I know that they are half of my problem.

[edit] also, as long as you destroy special effects, then it really doesn't matter how many you create right?
02-09-2004, 03:14 AM#2
Narwanza
Also, is origin of unit considered a location? If i don't destroy the origins I use would that create lag?
02-09-2004, 03:15 AM#3
Shimrra
Origin is just a place, usually the bottom, on a unit. It doesn't have anything to do with location unless your attaching special effects or some-such.
02-09-2004, 03:27 AM#4
Narwanza
Right, I knew that. What I was asking was, does it get stored into memory like a location, so therefore will it have to be removed to prevent memory leak. I think I will run a couple of test maps on this.
02-09-2004, 07:20 AM#5
35263526
A major cause of leaks in TDs and AoSes is the commands that create unit groups. Put this in front of each unit group trigger:
Custom Script: set bj_wantdestroygroup = true
02-09-2004, 08:17 AM#6
Cubasis
Firstly,

Are you confusing "Leaks" with simple Lag? or perhaps just slowness?. Cause memory-leaks in the game don't get noticable "while playing" unless they're REALLY horrid. Otherwise one just notices them when one quits the game (as that's where the leaked memory gets cleared, and thus, long-exit-times == Leaks.

Now.

Everytime you do something where you give it a point/location, it leaks. So yes!, you leak when you get the origin of units. Same (and even more-common) with "Center of Region" and... well, almost all the function-calls in the "Point" GUI window "leak" a point/location. Same with most of the function-calls in the Unit-Group window.

Anyways, these aren't always your problem, as you have to leak "ALOT" for it to be noticable, so not unless you're doing sumtin all of the time, with alot of leaks in it, do you have to worry about it.

Projectiles don't leak. But... they're graphic-card-intensive. It all depends on what it's shooting. You should be able to get a feel for your limits. F.ex., the simple arrow model is just one poly (almost) with a skin on it. Using that on a 0.001 cooldown tower is fine, but attaching intensive stuff like Flame-Strike on a 0.001 tower is crazy, as it simply is creating too many particles for low-end users to handle.

Hope this helps.

Cubasis
02-09-2004, 08:32 AM#7
Grater
Yeah "normal" memory leaks only really cause lag on systems with less than 256mb.

One thing that could cause lag is "unit is attacked" events, if you use this event at all it would be worthwhile to do some serious optimization.
02-09-2004, 11:02 PM#8
Narwanza
I do know all of that stuff you told me about memory leaks, and I think I have found the answer to my problem. It is actually blizzards problem. I don't think that blizzard cleaned up their bouncing projectile codes at all, because they didn't think it mattered. So, don't use bouncing projectiles unless it is going to be a short map. 35263526, that won't work for me because I am only creating 1 unit at a time, and I have that leak under control. In fact, I thought I had all under control until I played it online with other people. But that is when I realized bouncing projectiles are stupid. Do you think that they didn't clean up their splashing script either? Could splashing units cause leaks because it doesn't delete the groups? I dunno.

[edit]This discovery that blizzard doesn't clean up bounces is almost disturbing in a way. I mean, do they clean up their bountry triggers? What do they clean up, and what don't they?