Memory Leaks: Still a Major Issue in 1.4

Memory Leaks have been a problem for GalCiv2 since its release, and I applaud the developers for their tireless and dedicated efforts in attempting to resolve these leaks.

That said, the leaks are still an ever-present and annoying issue inherent to the game. Typically they don't manifest themselves until a saved game starts to reach a certain maturity level (say, once everyone starts nearing the end of the tech tree, and/or everyone has a ton of ships flying around). The biggest challenges to the RAM usage of the game seem to be:

1) The ship config files
2) The number of ships in play at any given time
3) The number of ship designs in play at any given time
4) Use of the Shipyard to design ships
5) Battles between ships
6) Planetary invasions
7) Game saves
8) Galaxy size

These instances burn a slow, but steady hole in system memory allocation -- eventually causing a game to grow more and more unstable as it progresses. In a typical game, for instance, I'll experience no problems at all until I reach a certain tech level, and the game has become particularly deep and involved. By then, the game will begin to crash nearly every time I design a new ship, or every handful of turns. Usually the game will freeze, but occasionally it will crash-to-desktop with an "out of memory" error message.

Just to give you a sense of my system setup: I'm running a 2GHz Core Duo laptop with 2GB RAM and a 4GB paging file. I have a fairly recent video card with 256MB of memory. I defragment my hard drive regularly, I run only GalCiv2 when I'm playing the game, and usually I quit / turn off my machine after an hour or two of play. Also, I clear out my ship config files and saved game files after every game runs its course. Basically, there is nothing about my system or my gaming habits that should cause this crash situation to happen.
13,767 views 31 replies
Reply #1 Top
The shipyard itself is a serious culprit in the memory use problem. Even in the early game, you can hear my computer struggling with it.

I've got a Pentium IV 2.93GHz, 2.25GB PC3200 RAM, a 4GB pagefile and a 512MB ATI Radeon X1300 PCI-E graphics card. It doesn't make the game unplayable, but it does set a definitely limit on how long you can play it depending on how deep into the game you are. It becomes an even greater problem when you cap a decent sized mod on top of it.
Reply #2 Top

There really haven't been any major (i.e. multi-megabyte) memory leaks in the game. A memory leak is defined as a memory allocation that is then lost to the game.

It is absolutely normal, however, for the game to use more memory as time goes on -- as you design more ships adn the AI designs more ships memory use will grow.

Reply #3 Top
If you use the "taskmanager" (CTRL+SHIFT+ESC), and look at the "Mem Usage" and "Peak Mem Usage" columns for the process, you will be able to track how much memory the game is using for you.

(If those columns are not showing, use "View->Select Columns" to add them in.)

Start the game, load up the save file, and record your memory usage.
Play for a while, record your mem usage.
Save, quit, reload, record your mem usage.

The numbers between step 2 and 3 will be different, but probably not insanely different. If they are, that is a possible sign of a leak. However, as Frogboy said, lots of ship designs and AI ship designs will consume a lot of memory.

Heh. Given what I've seen, the AI seems to have a lot of designs. This could be the source of your problem. You need to kill off a few AI ships....
Reply #4 Top

The big thing is the # of ship designs.

We originally only had the AI design new ships every game year because of memory and CPU considerations but it made the AI a lot less effective.

But the memory usage is pretty much on par or less with most modern PC games.

Reply #5 Top
I've only seen issues on massive maps with alot of AI players still in the game (while everyone is at war)... my main issue is getting the memory back when quiting the game. last night it took 30 min looking at the "a few more turns" overlay after selecting yes to exit, before I just turned off the laptop. that was after 2 hrs of gameplay.

I'm on a 2.0 AMD Turion 64 x2 with plenty of RAM and video...
Reply #6 Top
I find it is better to go out to the main menu, let the music transition fully, then quit.

Otherwise it does hang while exiting sometimes.
Reply #7 Top
I have never finished a game playing on anything larger than a medium map becuase of memory leaks, it was there when the game was first released and is still there unfixed.
Mind you Im a mug, everytime a new update comes out I give it another go and just as the game starts to get good CTD everytime. I don't see this ever getting fixed now, shame.
Reply #8 Top
Getting a CTD does not mean it was due to a leak. If you're getting any crashes, you should get SmartException from SDC and send in crash reports to help the devs find the causes and fix them.
Reply #9 Top
Been there, done that, bought the space ship.
Reply #10 Top
I have way too many ship designs. But on a huge map after an hour late in the gane, the game starts dragging. Usually saving and reloading helps.

I have a P4 3.2 gig with a cheapo memory card. Even after I end the game that I have played for a long time, my computer is sluggish unless I reboot.
Reply #11 Top
I have a hell of a time getting through a game on a huge map. Usually crashs on invasions for the most part. I can work around it by doing quick saves then reloading. Have my auto save at 5 but to be honest if there is alot of activity I have to save sometimes 2 or 3 times for any given turn. Find that the graphics sometimes go blank screen but shelling to windows then coming back to the game will reset it till the next invasion.

I have a dated system 2.4Mhz with 1 gig of mem and a 9700pro ATI card. All top of the line components when I purchased a few years back but you know how quickly you become obsolete (usually by the time you hook up the new system there is something better out   )

I would like to try the largest (gigantic?) map but sorta scared of even trying it based on my experiences with the 2nd largest.

Are there any folks out there who have played the largest scale map with a system that resembles mine with any sucess?
Reply #12 Top
Make sure your swapfile is at least 2GB, and make sure it is static instead of dynamic.
Reply #13 Top
There really haven't been any major (i.e. multi-megabyte) memory leaks in the game. A memory leak is defined as a memory allocation that is then lost to the game.

It is absolutely normal, however, for the game to use more memory as time goes on -- as you design more ships adn the AI designs more ships memory use will grow.


Then why if you you restart the game (i.e. save, quit, re-launch) and it'll use half of the memory it used before (or less). I've got 4 GB of memory and I'll get an out of memory exception at least a couple times when I play a Gigantic game with 9 AIs. I restart the game, and I'm using a bit under 1 GB.
Reply #14 Top
I'll add my two cents to this. I hadn't played GalCiv2 in a while (before the 1.3 patch, actually!) and reinstalled in the last couple of days. I hadn't had any crashes to desktop from out of memory that I remember before this and now, I've had several.

I know my system (P4 1.5 GHz, 512MB of RAM) isn't the most powerful but that's a little odd. GalCiv2 used to run just fine on my laptop and now? Running, running, running... *CLANG* as it hits a wall.
Reply #15 Top
ITS CALLED PAGING FILE YOU NEED TO EXPAND YOUR PAGING FILE SO YOU DONT RUN OUT OF VIRTUAL MEMORY GO TO MY COMPUTER ,CONTROL PANEL, SYSTEM, ADVANCE, PERFORMANCE SETTINGS,ADVANCE AND CHANGE, THERE YOU COULD EXPAND YOUR VIRTUAL MEMEORY OR JUST DEFRAGMENT YOUR HARD DRIVE
Reply #16 Top
ITS CALLED PAGING FILE YOU NEED TO EXPAND YOUR PAGING FILE SO YOU DONT RUN OUT OF VIRTUAL MEMORY GO TO MY COMPUTER ,CONTROL PANEL, SYSTEM, ADVANCE, PERFORMANCE SETTINGS,ADVANCE AND CHANGE, THERE YOU COULD EXPAND YOUR VIRTUAL MEMEORY OR JUST DEFRAGMENT YOUR HARD DRIVE


Your honestly telling us it's reasonable for it to consume most of 4GB and a 4GB paging file? And then you restart it and it consumes a small fraction of that? rofl.
Reply #17 Top
WHATS WRONG WITH THAT IF YOU ONLY HAVE 512MB OF RAM AND YOU DONT WANT YOUR GAME TO CRASH BECAUSE YOUR PAGING FILE IS TO SMALL, SOMEONE OBVIUSLY DOESNT HAVE THAT MUCH RAM OR THEY HAVENT DEFRAGMENTED THERE DRIVE, YOU ACT LIKE YOU CANT GET THAT 4GIGS BACK
Reply #18 Top
WHATS WRONG WITH THAT IF YOU ONLY HAVE 512MB OF RAM AND YOU DONT WANT YOUR GAME TO CRASH BECAUSE YOUR PAGING FILE IS TO SMALL, SOMEONE OBVIUSLY DOESNT HAVE THAT MUCH RAM OR THEY HAVENT DEFRAGMENTED THERE DRIVE, YOU ACT LIKE YOU CANT GET THAT 4GIGS BACK


The game is crashing on me with 4GB worth of Paging file and another 4GB of RAM. I don't think the problem is the fact he has 512MB of RAM. Increasing the paging file simply delays the problem for a bit and slows down the processing overall. He'd better of restarting it if he is having the same problem the rest of us seem too. The problem is the RAM usage steadily increases until there is no RAM left. You restart the game...and it's using 1/4 or less (at least for me). And he is saying it /used to/ run fine on his laptop...so it could be an entirely different problem.
Reply #19 Top
i would delete some temporary files from disk clean up because restarting your computer does not clean your page file. i would also check if your ram cards are the same megahertz of speed because mixing diffrent speeds could slow your computer down, other than that i dont know wat to tell you
Reply #20 Top
i would delete some temporary files from disk clean up because restarting your computer does not clean your page file. i would also check if your ram cards are the same megahertz of speed because mixing diffrent speeds could slow your computer down, other than that i dont know wat to tell you


Just 0o...I'm going to stop replying.
Reply #21 Top
No kidding.
Brownzie does not have a clue.

I have 3GB of ram, and a 3GB swapfile, and I get the dreaded Out-Of-Memory error now and then as well.

And when I exit and check my mem usage, it looks as though it should not have happened. It usually has maxed out at around 2.7GB total system usage.

The only times I have noticed it on my system has been when I have done 'too much' in a single turn. A war starts, and I destroy a LOT of ships and then proceed to taking 20-30 planets - all in that single turn.

If I invade a planet and the ground textures are missing (as in simply black), then when I try to save the game I will get an out-of-memory error and lose that save file. And it is always at the time the textures mess up. As long as the textures are fine, I can save the game. Once they mess up, I get the error.

I have gotten into the habit of saving 2 files (i.e. - 'Game1' and 'Copy of Game1') whenever I get into a war, just because of that error.

But it does seem to be related to how much ram is actually being used, as opposed to a combination of ram and swapfile space. And for me it also seems to be related to how much goes on in a single turn. I never get out-of-memory errors if I process a turn before it happens.
Reply #22 Top
Im simply repliying to the person who has 512 mb of ram and there game is shutting down because they ran out of paging file, you guys on the other hand have a diffrent promblem so dont get mad when im not even repling to you guys.
Reply #23 Top
make sure it is static instead of dynamic.


How do I check this?
Reply #24 Top
make sure it is static instead of dynamic.


How do I check this?


Yeah, I'd like to know that one too. Don't recall seeing the option anywhere... but that doesn't mean it doesn't exist.

Are there any folks out there who have played the largest scale map with a system that resembles mine with any sucess?


My system is an HP Pavilion a1410n Media Center Edition with an AMD 3800 2.5 processor, running with 1GB ram and integrated graphics (nvidia 6150LE). Before upgrading to a graphics card, I tweaked the virtual memory up to 4095 for min/max. This 'seems' to have helped, along with updating drivers of course, and I only play on gigantic with all opponents enabled. After a few hours there would be freeze up issues at times, but randomly. Upgraded to a nvidia 7600GT and now this game is beautiful... and this card isn't even all that! My point is, my system was about on par with what you have, and eventually after some tweaking, the game worked. Some players experience issues almost daily (as I did) while others seem to have no problems whatsoever. It is odd and I can't understand it, but then all PC's are inherently different so...