How does HudMessage`s memory clearing work?

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE? Did your computer break? Ask here.

Moderator: GZDoom Developers

How does HudMessage`s memory clearing work?

Postby Bilbö Bägginson » Thu May 26, 2022 5:22 am

I made a function to play a video clip. Made it via acs-cicle not via animdefs becase I want it to play from the begining when level starts.
And just about on the 600th frame, RAM starts to quickly feel up from ~400 mb to 1500—2000 mb by the end of the clip. So it causes severe stuttering on the screen.
Code: Select allExpand view
 for(int i=1; i<946; i++)
 {
  if(i<10) string = "ASHW00";
  else if(i<100) string = "ASHW0";
  else if(i<1000) string = "ASHW";
  Frame = strParam(s:string, d:i);
  setfont(Frame);
  hudmessage(s:"a"; HUDMSG_PLAIN, i, cr_white, 475.0, 360.0, 0.06);
  delay(2);
 }

Maybe there is a way to clean memory by hand in the script?
User avatar
Bilbö Bägginson
 
Joined: 30 Nov 2020
Discord: Bilbö Bägginson#4376
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: How does HudMessage`s memory clearing work?

Postby Graf Zahl » Thu May 26, 2022 5:44 am

How large are the textures? It doesn't really matter if you use this or ANIMDEFS - the texture management currently has no eviction logic for textures taking up too much memory so all your frames add up.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How does HudMessage`s memory clearing work?

Postby Bilbö Bägginson » Thu May 26, 2022 6:42 am

Graf Zahl wrote:How large are the textures?

From 14 to 60 Kb,
30 Mb in total
User avatar
Bilbö Bägginson
 
Joined: 30 Nov 2020
Discord: Bilbö Bägginson#4376
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: How does HudMessage`s memory clearing work?

Postby Graf Zahl » Thu May 26, 2022 8:42 am

I mean size in pixels.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How does HudMessage`s memory clearing work?

Postby Bilbö Bägginson » Thu May 26, 2022 9:18 am

Graf Zahl wrote:I mean size in pixels.

Ah 1280x720
User avatar
Bilbö Bägginson
 
Joined: 30 Nov 2020
Discord: Bilbö Bägginson#4376
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: How does HudMessage`s memory clearing work?

Postby Graf Zahl » Thu May 26, 2022 10:30 am

Those textures combined will be an entire GB of VRAM. The texture manager wasn't really made for this kind of animation. Depending on your memory situation part of that GB will end up in the main RAM.

I think the only way to handle this case is to add a means for the mod to explicitly evict a texture it knows it doesn't need anymore- Of course you have to be careful then to do the eviction only if the texture is definitely not being rendered anymore - otherwise it'd just be recreated again and not be deleted a second time.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How does HudMessage`s memory clearing work?

Postby Bilbö Bägginson » Thu May 26, 2022 11:26 am

Completely delete textures from pk3 so they will never can be played again? Sounds not good. I`ll try to resize them maybe.
But Im interested, if there is any way in gzdoom now to delete lumps from archive right while the engine is running?
User avatar
Bilbö Bägginson
 
Joined: 30 Nov 2020
Discord: Bilbö Bägginson#4376
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: How does HudMessage`s memory clearing work?

Postby Graf Zahl » Thu May 26, 2022 11:30 am

No, delete from memory after you displayed them. This will require an engine change.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How does HudMessage`s memory clearing work?

Postby Bilbö Bägginson » Thu May 26, 2022 11:41 am

Graf Zahl wrote:No, delete from memory after you displayed them.

That would be great feature.

I`ve resized them to 640x360 and there is no leak now. But I do not know if it will not be on other computers with less Vram.
User avatar
Bilbö Bägginson
 
Joined: 30 Nov 2020
Discord: Bilbö Bägginson#4376
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support


Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 0 guests