Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: WMCoolmon on July 08, 2004, 04:46:43 pm

Title: Teh memory leak
Post by: WMCoolmon on July 08, 2004, 04:46:43 pm
Okay, it looks as if fs2_open has a serious memory leak problem; generally, I can get away with 3 missions before I CTD.

Info I've gathered, posted all this in Bobb's latest thread:
Quote
I tried another memory tracker (mmreg) and it found nothing wrong.

Quote
There aren't any memory leaks after Freespace 2 closes, but there ARE big increases in the memory it takes up while it's running

Quote
I opened FS2 (debug) in windowed mode, along with the Win2k task manager. Loaded the mission, exited, loaded it again.

What happened with memory usage was that after I closed the mission, it remained the same. When I started the mission, it would go back down (partially, IIRC) to what it was before, then just before it finished loading it would spike back up to about 100 MB more than before.


Does anyone have any additional info/ideas? It's not environment mapping or any of Bobb's recent changes, since people were reporting this right after 3.6 came out.
Title: Teh memory leak
Post by: SA22C on July 08, 2004, 08:40:49 pm
I'm not sure what's going on, but I only get two missions before my computer runs out of memory.
Title: Teh memory leak
Post by: Taristin on July 08, 2004, 09:13:22 pm
Mine'll die after about 20 minutes... Low ram and all.
Title: Teh memory leak
Post by: kasperl on July 09, 2004, 05:02:57 am
Sound preloading in uncompressed formats?

Dunno, my system is too unstable for serious testing, I'm afraid.

Does it leak the same with retail data?

I'm going on a fishing expidition with ideas here, but someone might get a lightbulb over his head if we brainstorm enough.
Title: Teh memory leak
Post by: Tepa on July 09, 2004, 07:25:57 am
seems like 07072004 gots big leaks too
havent my self got it thx to 1gig ram+w2k
but friends do get em on XP "run outta virtual memory" crash on to desktop after 2-5mins of playing
earlier 3.6build was much better faster loadin and less crashy,
now gotta wait on mission load ages and while that u get timed out or some else gets it
Title: Teh memory leak
Post by: Setekh on July 09, 2004, 07:38:46 am
Welcome to HLP, Tepa :)

:welcome:
Title: Teh memory leak
Post by: wolfdog on July 09, 2004, 07:45:15 am
I don't have that problem....
using win2k wih 1gig of ram
Title: Teh memory leak
Post by: Jetmech Jr. on July 09, 2004, 08:16:34 am
I never get memory problems, except with certain campaigns like Casualties of War.
Title: Teh memory leak
Post by: wojta on July 09, 2004, 08:25:53 am
I have tried 3.6 from CVS 8.6 and one got yesterday. The first build crashes after 2-5 missions played. The newer ones builds crash mostly earlier. I'm getting Out of memory error and it seems that it takes over 1GB of memory.
Title: Teh memory leak
Post by: Kazan on July 09, 2004, 08:40:38 am
someone introduced huge memory consumption a long while ago.. any we never traced it down - i need to find a program that will give me a per-module lineup of what's using memory
Title: Teh memory leak
Post by: Kosh on July 09, 2004, 09:30:30 am
Here are my figures when I played the mission "Nekhbet":

Using physical: 192 meg
Using pagefile: 306 meg
Using virtual: 560 meg

physical free: 7/382 meg
pagefile free: 445/921 meg
virtual free: 1410/2047 meg


Explosions and flak really slow it down the most. I am using a modified 3.6 build Taylor gave me. He fixed some of the memory leaks, and so it is better now than it was. But it still uses a ton.
Title: Teh memory leak
Post by: Moonsword on July 09, 2004, 09:32:41 am
You've probably thought of this, Kazan, but try SourceForge (www.sourceforge.net).  They might have something you can use.

All I can add, sorry.
Title: Teh memory leak
Post by: Arc on July 09, 2004, 10:42:14 am
Quote
Originally posted by Kazan
i need to find a program that will give me a per-module lineup of what's using memory

Would this be of any use? http://valgrind.kde.org/index.html It is GPL software, but it's Linux based. Maybe taylor or someone could run it?

I mention it cos of one of the tools (http://valgrind.kde.org/tools.html):
Quote
Massif is a heap profiler. It performs detailed heap profiling by taking regular snapshots of a program's heap. It produces a graph showing heap usage over time, including information about which parts of the program are responsible for the most memory allocations. The graph is supplemented by a text or HTML file that includes more information for determining where the most memory is being allocated. Massif runs programs about 20x slower than normal.
Title: Teh memory leak
Post by: Starman01 on July 09, 2004, 01:52:06 pm
No Idea about coding, but I had the most problems with
texture-load. By mission-loading, and sometimes in-mission (when ships
jump in). Also a big problem are wrong loaded background-files,
because facing them drops the Framerate in the cellar.

Restarting solves that issue in the most cases.
Title: Teh memory leak
Post by: Kazan on July 09, 2004, 02:22:03 pm
i'm setting something up
Title: Teh memory leak
Post by: WMCoolmon on July 09, 2004, 03:46:42 pm
More possibly-related info: I've been crashing when Wavedata_load_buffer is freed, specifically on the line
Code: [Select]
int actual_size = HeapSize(Heap, HEAP_FLAG, ptr);

It DOES seem to be allocated somewhere, too.
Title: Teh memory leak
Post by: Tepa on July 09, 2004, 04:24:25 pm
odd i dont get any framerate issues but now i ran outta 1gig ram
after 3 games missiles went retarded and restart for comp took ages when cleaning ram..
note that was on multiplay.
Title: Teh memory leak
Post by: Hippo on July 09, 2004, 05:26:41 pm
I don't get any problems with memory... I've only got 320 Mb SD, though i've set aside 2048Mb Virtual...
Title: Teh memory leak
Post by: Tepa on July 10, 2004, 06:46:01 am
then it seems like multiplay uses hell alot memory.
1gig phys+512virtual and when it goes on virtual
thats when ppl start cry about bad weapons even host gets em
Title: Teh memory leak
Post by: vyper on July 12, 2004, 09:13:07 am
It all slows down the longer I play, and eventually after about three missions (insanely long missions from my archived version of maelstrom I'll admit) it crashes out with an out of memory error.

Boo.
Title: Teh memory leak
Post by: Tolwyn on July 12, 2004, 09:18:45 am
yep, same issue was reported by one of WCS members

Quote
I got around the same specs as yours, so technically you can run it. But I have to end up cold-booting after 3 missions or so because the resources sucks up everything else on my computer afterwards.
Title: Teh memory leak
Post by: Cabbie on July 12, 2004, 09:26:10 am
same problem here. After 2 to 3 missions or so I ran out of memory too. Half a gig of ram here.
Title: Teh memory leak
Post by: Lightspeed on July 12, 2004, 10:15:45 am
When I've played a while and in a heavy mission it uses more than 1400 MB of memory. So yes, there's DEFINATELY something wrong there.

Also, it gets very weird errors after a few missions (errors parsing the various tables because it can't load briefing icons, missing textures, missing interface graphics - you get the idea). There seems to be something whacky about the loading code as well as some serious in-game leaks.
Title: Teh memory leak
Post by: RandomTiger on July 12, 2004, 01:14:33 pm
Does this happen when the -d3d_bad_tsys flag is used?
Title: Teh memory leak
Post by: Tepa on July 12, 2004, 01:57:56 pm
testin 1207build with that flag now lets see what happens
Title: Teh memory leak
Post by: Lightspeed on July 12, 2004, 04:36:19 pm
Quote
Originally posted by RandomTiger
Does this happen when the -d3d_bad_tsys flag is used?


yes. It happens with both flags. The only difference is that with -d3d_bad_tsys it stays at a relatively high value and thus produces stable FPS, whereas without the flag memory on my vid card (only there) is constantly freed and immediately blocked again during the mission, which causes the most ugly lockups, even if the average FPS is about 0.2 better.
Title: Teh memory leak
Post by: RandomTiger on July 12, 2004, 05:11:33 pm
Interesting, thanks.
Do the lock ups occur because of pcx or ani's?
Title: Teh memory leak
Post by: Kosh on July 12, 2004, 07:39:20 pm
For me whenever there is an explosion (including flak bursts) it slows down a ton (the HDD activity light is always on during these slowdowns). Even the -d3d_bad_tsys this happens. This was with Taylor's modified 3.6.
Title: Teh memory leak
Post by: jdjtcagle on July 12, 2004, 07:52:05 pm
With Lightspeeds newest modified explosions?
Me thinks you don't have the right ones
Title: Teh memory leak
Post by: Trivial Psychic on July 13, 2004, 12:41:35 am
Here's an interesting one.  I noted this in Bob's environment build, but I just tested with WMcoolmon's latest and encountered the same thing, so this too may be a symptom of maxing out memory.  After I've played 3 or 4 missions, ani will stop playing.  I've had it with the loading bar, CB-ani, Ship select ani, weapon select ani, and even some of the interface anis.  I quit the game, control-alt-del and shut down explorer (Win98) (I've heard that this can clear out some memory), then restarted and everything worked fine.

Later!
Title: Teh memory leak
Post by: Kosh on July 13, 2004, 09:13:05 am
Quote
With Lightspeeds newest modified explosions?



Yes.


EDIT: Oh, it was with his explosions v1.0. I just played a little with v2.0 and it was better. Still uses too much memory.
Title: Teh memory leak
Post by: Lightspeed on July 14, 2004, 10:20:46 am
Quote
Originally posted by RandomTiger
Interesting, thanks.
Do the lock ups occur because of pcx or ani's?


neither. The lockups seem completely random. it's just mem getting freed and loaded up again without apparent reason (i.e. no ships jumping in or anything).

Suddenly my texture mem free jumps from 1-5 to around 88, just to drop back to 1-5 in a fraction of seconds - in the fraction of a lockup.

It isn't touching any pagefile or physical memory at all.
Title: Teh memory leak
Post by: Tolwyn on July 15, 2004, 11:03:56 am
hmm.. somehow the problem is getting worse with 3.6 vps. I have managed to run out of memory with 1 GB of ram