Console memory lag issue

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Console memory lag issue

Post by unknownna »

0001897: CPU-like lag when picking up items or when flag is taken/dropped/returned after a dozen map changes || Console memory issue

There seems to be some serious memory issues with ZDoom's console. The more lines of text there are in the buffer, the more the gameplay lags/stutters when new messages are printed, e.g. when picking up items. This is very frustrating to play with in competitive settings since it throws off your movement prediction.
console_lag.wad
(3.31 KiB) Downloaded 56 times
Steps to reproduce:

1. zdoom -iwad doom2.wad -file console_lag.wad +map map01 +sv_itemrespawn 1 +cl_capfps 1 +msg 0
2. Pick up the armor bonuses. Notice how smooth the movement is.
3. Copy-paste:

Code: Select all

cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist;cmdlist
into the console. Depending on how powerful your CPU is you might have to repeat this step.
4. Pick up the armor bonuses. Notice how choppy the movement is. If you repeat step 3, it'll get even choppier.
5. "msg 1" in the console.
6. Pick up the armor bonuses. Notice how smooth the movement is again due to the lack of printed messages.

Make sure that cl_capfps is set to 1 to really notice and observe it.

This issue becomes very noticeable after approx. 1.5-2 hours of high-intensity CTF gameplay on Zandronum due to all the messages that pile up in the console (obituaries, chat, join/connect/disconnect and flag messages). ZDaemon apparently worked around this by not storing too many lines in the console and also by increasing whatever buffer there is (according to the changelog), thus the gameplay remains 100% smooth there.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

Have you tried playing around with the con_buffersize CVAR?
It may be necessary for Zandronum to set another limit here. ZDoom's is indeed unlimited and never deletes any console content at its default setting.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

I tried to raise the value, but it didn't seem to help at all. So is it safe to assume that this will not be changed in ZDoom at all in any shape or form?

Edit:

Actually, ZDoom and ZDaemon seem to store the same (or similar) amount of lines, so the problem must be something else.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

I'M closing this now. Checking Zandronum's source I noticed that it still uses the old console buffer. I replaced that in ZDoom sometime last year so any issues with the old version are not relevant for ZDoom anymore.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

But it's still relevant. I still notice the behavior in zdoom-x64-2.8pre-1662-gfe2e293.7z.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

That's why there's a CVAR to limit the buffer size. I'm not going to disable the option to keep all console content just because it may cause slowdowns after hours of play.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

So, by decreasing the con_buffersize value, it should improve the behavior? From what I can tell it doesn't improve anything. The lowest value is apparently 128. There's no difference between -1, 128 or 2147483647.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

Then I have no idea what's happening but it can't be the console buffer.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

But it must have something to do with messages that are printed since the lag that occurs when picking up items goes away if you change "msg" from 0 to 1.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

What happens if the console is full and you clear it with the 'clear' command?
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

Unfortunately nothing happens. It clears out the text, but it still lags/stutters just as much. The only way to work around this currently is to quit and restart (g)zdoom/zandronum.exe.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

This didn't happen in earlier versions of ZDoom (2.1.1). I'll investigate this further.

1.22 - Very fast and very stable.
1.23b33 (ZDaemon) - Same as above.
2.0.40 - Same as above.
2.0.63a - Very fast, but crashes if the command is pasted too often in the console during gameplay.
2.0.90 - Same as above.
2.0.94 - Same as above.
2.0.95 - Starts to lag slightly when pasting the command. Also crashes if the command is pasted too often in the console during gameplay.
2.1.0 - Same as above, but it doesn't crash anymore.
2.1.1 - Same as above.
2.1.2 - Starts to lag more when pasting the command.
2.1.3 - Same as above.
2.1.4 - Same as above.
2.1.5 - Same as above.
2.1.6 - Same as above.
2.1.7 - Same as above.
2.2.0 - Problem starts to appear. Starts to lag considerably more when pasting the command. Gameplay starts to lag.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

Thanks for mentioning 2.0.95. In that version the edit control was added to display the error window. And THAT definitely can cause problems. (And guess what: This actually never gets cleared at all...) And in 2.2.0 it was replaced with a RichEdit control, therefore the increase in lag.

I think the best course of action here will be to omit pure in-game messages from being added there, that'll require quite a bit of work, though (and special handling for Zandronum's own messages.)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Console memory lag issue

Post by Graf Zahl »

As a quick test: Comment out the I_PrintStr call in c_console.cpp:PrintString to see if this helps resolve the lag.
unknownna
Posts: 215
Joined: Sat Oct 06, 2007 4:45 pm

Re: Console memory lag issue

Post by unknownna »

I don't know how to compile builds since I'm not a coder/programmer, so unfortunately I can't test it.
Post Reply

Return to “Closed Bugs [GZDoom]”