Debugging Lag after Alt-Tab

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
I know a few users reported this and I've seen it happen twice myself. It seems that some of the time, after Alt-Tabbing out and back into the game, the camera lags and visibly fights the user in trying to adjust the few. In my experience, after about 10 seconds, the lag goes away and the camera becomes usable again.

Have other users seen this behavior too? If so, on what revision?

Also, does anyone have a reliable way to reproduce this lag? So far, the issue does not crop up every time I Alt-Tab, I've only seen it twice out of hundreds of times.
 
Do you have a reliable way to cause the lag issue? I can't reliably reproduce it.
 
Also on a kind of related note does anyone else have the issue where they can't load a saved game after awhile without minimizing?

So I will be playing my game for an hour, then really bork something up and load the last auto-save. But if I don't minimize the game it will just spin on the loading screen forever. The first time I start the game and load everything is fine, but after that initial load if I have to do it again I have to minimize the game. It has been like this for a very long time.
 
Also on a kind of related note does anyone else have the issue where they can't load a saved game after awhile without minimizing?

So I will be playing my game for an hour, then really bork something up and load the last auto-save. But if I don't minimize the game it will just spin on the loading screen forever. The first time I start the game and load everything is fine, but after that initial load if I have to do it again I have to minimize the game. It has been like this for a very long time.

Hmmm. I can't say I've ever seen that. Are the saves big when this starts happening? If I had to guess, I would say that the game is using a lot of RAM and forcing your system to start swapping, and swap memory is very slow.
 
Also on a kind of related note does anyone else have the issue where they can't load a saved game after awhile without minimizing?

So I will be playing my game for an hour, then really bork something up and load the last auto-save. But if I don't minimize the game it will just spin on the loading screen forever. The first time I start the game and load everything is fine, but after that initial load if I have to do it again I have to minimize the game. It has been like this for a very long time.

No, never seen something like this.
 
Hmmm. I can't say I've ever seen that. Are the saves big when this starts happening? If I had to guess, I would say that the game is using a lot of RAM and forcing your system to start swapping, and swap memory is very slow.

That possible, I could be hitting the 3gb limit or whatever it is, they are quite large games. So then I guess the question is why isn't the game flushing the memory when I hit load like it does when I minimize the game? I don't need the game I just left still in memory.
 
Is there also a reason why the Building Screen in WorldBuilder explodes when I alt-tab out of it? I use WorldBuilder to test stuff, and if I open WorldBuilder, open the Edit City screen, and go over to Buildings, then alt-tab out of the game with the screen open (in order to search the XML file to find where a building is so I have an idea of where to look for it in WB), when I return, the screen is supersized and there is no way out of it except to exit WB and re-enter. I think it might be that my screen resolution gets cranked down to play Civ4, and when I go out, the resolution goes back up and the WB building window resizes for that.

View attachment 391484
 
@Vokarya: You should start the mod in windowed mode when editing the game! It's much easier to code!
 
@Vokarya: You should start the mod in windowed mode when editing the game! It's much easier to code!

Or, even better, set the civ4 ini file to "ask" instead of 0 or 1 for windowed mode. Each time you launch, you can choose which mode to play in.

Is there also a reason why the Building Screen in WorldBuilder explodes when I alt-tab out of it? I use WorldBuilder to test stuff, and if I open WorldBuilder, open the Edit City screen, and go over to Buildings, then alt-tab out of the game with the screen open (in order to search the XML file to find where a building is so I have an idea of where to look for it in WB), when I return, the screen is supersized and there is no way out of it except to exit WB and re-enter. I think it might be that my screen resolution gets cranked down to play Civ4, and when I go out, the resolution goes back up and the WB building window resizes for that.

View attachment 391484


I am pretty sure the WB menu is python code we can edit...you might be able to find it and fix it yourself.
 
That possible, I could be hitting the 3gb limit or whatever it is, they are quite large games. So then I guess the question is why isn't the game flushing the memory when I hit load like it does when I minimize the game? I don't need the game I just left still in memory.

Well, I believe Civilization 4 BTS's latest patch enabled larger-size addressing, which allows a process on windows to use up to 64gb of ram.

I don't know. I don't have access to the core game engine in the EXE, so a lot of the finer details of memory management are opaque to me. If I had to guess, I would say it's your operating system, not the game that's to blame. When you minimize the game, windows probably thinks you are not using it and frees some of the memory to your hard disk swap space. When you go to load a large game, it is forced to restore the memory from disk and this is quite slow...

Anyway, just a theory, it could be something else entirely. The fact that it doesn't crash, but just operates slowly is why I suspect swap space. Upgrade your RAM!
 
Well, I believe Civilization 4 BTS's latest patch enabled larger-size addressing, which allows a process on windows to use up to 64gb of ram.

I don't know. I don't have access to the core game engine in the EXE, so a lot of the finer details of memory management are opaque to me. If I had to guess, I would say it's your operating system, not the game that's to blame. When you minimize the game, windows probably thinks you are not using it and frees some of the memory to your hard disk swap space. When you go to load a large game, it is forced to restore the memory from disk and this is quite slow...

Anyway, just a theory, it could be something else entirely. The fact that it doesn't crash, but just operates slowly is why I suspect swap space. Upgrade your RAM!

I believe the larger address size only lets it do 4gb of ram, and I have 16GB so I think I am as good as its gonna get. :D

Also another minimize/maximize issue, the toggle-able resource icons stop working after you've minimized/maximized a few times, maybe even once will do it.
 
@Combat

There is a small 4gb_patch that was put out for x64 OS. It helps some. It's located here on CFC.

I tried to Upload it but since I've already done that in the C2C subforum it won't let me do it here. If I can find that post again I'll link it.

Edit: http://ntcore.com/4gb_patch.php

JosEPh
 
A long time ago, I had the idea the invite the user to patch the executable via the launcher. Don't know if it's a good idea.

About the patch, no matter your RAM amount, the 32bit executable is capped at 2go by default. If you apply the patch, it should remove that limitation.
 
@phillipschall,

Didn't you make the 4gb_Patch? If you did Thank you. :)

JosEPh
 
I believe the larger address size only lets it do 4gb of ram, and I have 16GB so I think I am as good as its gonna get. :D

Also another minimize/maximize issue, the toggle-able resource icons stop working after you've minimized/maximized a few times, maybe even once will do it.

Hmm.... You're right about the 4gb limit for 32 bit processes. I am reminded of hacks skyrim modders did to get around this, they created a 2nd 64bit process and stored a lot of the game memory there, then shared it between them. But I don't think we actually need that.

Out of curiosity though, what does the system monitor show your memory usage is when you hit that save/reload issue?

@Combat

There is a small 4gb_patch that was put out for x64 OS. It helps some. It's located here on CFC.

I tried to Upload it but since I've already done that in the C2C subforum it won't let me do it here. If I can find that post again I'll link it.

Edit: http://ntcore.com/4gb_patch.php

JosEPh

Beyond the Sword has this set already by default. Earlier expansions and Vanilla did not.

A long time ago, I had the idea the invite the user to patch the executable via the launcher. Don't know if it's a good idea.

About the patch, no matter your RAM amount, the 32bit executable is capped at 2go by default. If you apply the patch, it should remove that limitation.

Everyone on a 64bit OS can use all 4gb of ram. I've never used the patch and I have seen > 2GB ram used. Beyond the Sword had it enabled already.
 
Hmm.... You're right about the 4gb limit for 32 bit processes. I am reminded of hacks skyrim modders did to get around this, they created a 2nd 64bit process and stored a lot of the game memory there, then shared it between them. But I don't think we actually need that.

Out of curiosity though, what does the system monitor show your memory usage is when you hit that save/reload issue?

About 2.5GB
 
<snip>


Beyond the Sword has this set already by default. Earlier expansions and Vanilla did not.



Everyone on a 64bit OS can use all 4gb of ram. I've never used the patch and I have seen > 2GB ram used. Beyond the Sword had it enabled already.

It must be incorporated in the .exe then. I added it manually and I could go to 2.4->2.6GB before MAFs and/or CTDs started occurring. Before that if I hit 2.2GB I would start with the problems.

And I have 8GB Ram and a Geforce GTX 550 Ti vid card with 1GB Vram on Win 7 64 Pro OS.

I do know that when my system hits Combats 2.5+Gb mark I'll start having the occassional MAF or CTD. I see Combats system is 32 bit.

I normally run between 1.5 to 1.9GB using C2C. I have not checked AND's usage lately. But C2C is doing a Lot of graphic overhaul on all art as the Mod had swelled to 2.75 GB and is now around 1.76GB in size.

Maybe The Art/graphics for AND needs some help?

JosEPh

@Combat,
Is your BtS thru Steam?
 
Top Bottom