Author Topic: memory leaks  (Read 2741 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I'd like everyone who reads this to hit ctrl-alt-del, write down how much memory they are useing run FSO, write down how much they were usieng after and repete this sevral times, indicate in a responce on this topic how much memory you lost for each session and indicate how far into the game you played (ie did you play any mission if so how many, did you go to the tech room if so how many ships did you veiw, ect...)
were in the middle of some memory leak hunting right now, and I think this information would be useful
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
I did a bunch of leak testing in Valgrind for the icculus.org version and the only big leak I found that wasn't *nix specific was with the talking heads.  The problem was that it keeps track of only the base type of anim to be played and not the a, b, c versions.  The anims would have multiple instances but with different data so the old data just got left around and never free()'d since the *p was replaced with that of the newly malloc()'d data.  Depending on the mission you could end up with about 15Megs or more of lost memory.

The fix is in two parts, part one is to see of the currently loaded message slot contains data and if so check the filenames to ensure they the same.  If they are different then run it through anim_free() before the new anim_load().  The second part is to keep going through anim_free() on mission shutdown the verify that all reference counts are properly handled and all data is free()'d.

Look here for a diff on the icculus.org CVS of what I added.  There may be a better way to handle this problem but after a lot of testing it was the only method I thought of that worked consistantly.

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
How do you check the memory usage in 98 or Me? I have a program to check processor thread usage but not memory usage.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I'm not sure..
and I'll try implementing that (crediting you)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline KARMA

  • Darth Hutt
  • 211
    • http://members.fortunecity.com/aranbanjo
in w98se I have a resources measuring tool, which show 3 statistics: system resources, user's resources and GDI resources

I aslo have system monitor, which can show many indexes, like allocated memory, cpu usage, swapping, etc

 

Offline diamondgeezer

CyberLat RAM Cleaner. Gives a handy realt-time read out of available RAM :nod:

I'll run some tests later on

 

Offline Turnsky

  • FOXFIRE Artisté
  • 211
  • huh?.. Who?.. hey you kids, git off me lawn!
the memory leak problems are so bad.. well lemme put it this way..

i have 256 mb of ram, and gave the page file 1 gb to play with...

"out of memory" errors..
   //Warning\\
---------------------------------------------------------------------------------
do not torment the sleep deprived artist, he may be vicious when cornered,
in case of emergency, administer caffeine to the artist,
he will become docile after that,
and less likely to stab you in the eye with a mechanical pencil
-----------------------------------------------------------------------------------

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
well that isn't memory leaking that's memory useage, it's looking more and more like your going to need at least 512 megs of memory at the absolute minimum and a large pageing file
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline RandomTiger

  • Senior Member
  • 211
Quote
Originally posted by Bobboau
it's looking more and more like your going to need at least 512 megs of memory at the absolute minimum and a large pageing file


Even with the new builds? I dont think its that high with default data. If it is we will have to bring it down.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
it's that high with default data.

I load up the last mission and nearly 700 megs of ram is gobbled up (180 of wich was gone before I even started FS, so it's closer to 500)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

  

Offline RandomTiger

  • Senior Member
  • 211
Something is wrong then, I know weve upped limits but thats no excuse for a rise link that. Look at fs2's orginal requirements!

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Yeah, that's definitely way too high. The original FS2 used to require just 32mb; that is of course impossible now, but something like 192 or 256 would be more realistic.

DG: you have to pay for that though. Is there a free one somewhere?

 

Offline diamondgeezer

Quote
Originally posted by CP5670
DG: you have to pay for that though. Is there a free one somewhere?

Read it again - free trial with no time limit and very minor limitations

It'd slightly odd, but I actually have 50 or so MB more free RAM after exiting FSO than I did before I ran it...

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Bobboau: I was updating with Linux code with the current CVS version and I noticed the one block of code for the memory leak in missionmessage.cpp was put in the wrong place.  This:
Code: [Select]
// free up remaining anim data
for (i=0; iif (Message_avis[i].anim_data != NULL) {
      for (j=0; jref_count; j++) {
         anim_free(Message_avis[i].anim_data);
      }
   }
   Message_avis[i].anim_data = NULL;
}

should be in message_mission_shutdown() rather than messages_init().  That data isn't accessible at the start of a mission.  I should have pointed that out a little better, sorry for the confusion.

For everyone else testing for memory leaks a good mission to try is the last one in the original campaign ("Apocalypse", sm3-10.fs2).  I believe that it contains most of the ship models in the game (28 of them), quite a few weapon types (at least 9), a lot of jump ins/outs (not going to bother counting), plays nearly all of the hud animations and I think it lasts for a good 20 minutes if not longer.  Plus it's got the strange ending which runs it through some different code.  I did most of my memory leak testing with this level under Linux.  Just an idea for those that are also looking for memory issues.

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Quote
Read it again - free trial with no time limit and very minor limitations


oh, now I see what was happening. The download link is only in the popup that shows upon loading the website and I was closing it before it loaded, thinking it was just an ad.

Anyway, bobboau, what version of FS2 should I be testing? There are like ten different post-01_20_2004 exes floating around at the moment.

[edit] I tried out the 1_20_2004 one and it uses up around 280mb upon just running the exe. The numbers I gave earlier are probably far too high since it appears that almost no other game I have uses over 100mb at a time. Even the UT2004 demo appears to use only about 70mb. Considering that the original 1.2 uses something like 50mb, there is definitely a big problem here.

[edit2] I tried the build in the shinemap problems thread and that seems to be vastly improved; it's about 102mb now at startup. Whatever you did, it looks like it worked bigtime. :yes: I will post in-mission memory usage a bit later.
« Last Edit: February 22, 2004, 12:34:02 am by 296 »

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
I posted a Valgrind log of the Linux version here.  Probably won't be much help to anyone but it's there for reference at least.  The Linux version uses about 250Meg (HT&L, DDS planets, 1024x768) on the high end, maybe up to 300Meg on with a really large mission, and may lose a few K between missions but it's kind of hard to measure that.  Please note that this log file is not with DDS planets since DevIL has a problem not freeing all memory when an image is closed, it's not the game in other words.

From the log though, the message_play_anim() problem is still there, that block of code listed earlier still needs to be moved into the shutdown function. wl_load_all_anims() is leaking a little but I'm pretty sure I fixed this in the icculus.org stuff so I'll go dig that code up.

There is some system lib stuff that should be ignored and few parse related leaks but those just aren't closed out properly on game shutdown rather than leaking in-game. Kind of the same thing with opengl_tcache_init().

 

Offline Fractux

  • 28
This is just a repost of what I placed in the FPS thread. [ http://www.hard-light.net/forums/index.php/topic,20760.0.html ]



Quote


[....]

Oh yeah, and this is even with the -pcx32 flag turned off. (Which I was using for a while, but now leave off because it chews up some memory and, as you can see, I need all the memory I can get I only have 384MB RAM)

-pcx32 -jpgtga -htl -fps (-window : used to get memory use)(build 1-20-04)

1024x768 [D3D]
2xAA
4xAniso.
Best Quality (53.03 drivers)
using EAX (Fortissiomo II)

MEMORY VALUES ARE MINUS THE USAGE BEFORE STARTUP (120MB)

-STARTUP -> MAIN HALL: 282 (CPU usage at 80%)
-VISITED TECH ROOM [did not look at a different model] (CPU usage at 100%): 271
-EXITED TECH ROOM: 287 (CPU usage at 80%)
-Start Campaing: 490 (Homesick - Capella Capella)
-Committ Mission: 611 (CPU usage ~85-98%)
-Quit mission: 645
-Quit FS: 0 (back to 120MB)

....



Cheers!
« Last Edit: March 04, 2004, 04:34:51 pm by 1248 »
-What exactly gets separated in "mechanically separated chicken" ?