Discussion:
[hlcoders] hlcoders Digest, Vol 46, Issue 3
Shokunin
2015-02-18 03:57:05 UTC
Permalink
Thanks Geotavros, after watching the memory usage its about a 125mb
difference when loading directly versus playing through the entire mod,
definitely some sort of leak! It's not constantly growing when standing
idle but it does progressively grow through various events while playing.
My biggest suspicion are possible leaks during level transitions, I really
expect more memory to clear.

Any advice / tips / techniques for tracking down memory leaks would be
greatly appreciated.

This page was helpful for anyone interested:
https://developer.valvesoftware.com/wiki/Memory_Leak_Fixes

I'm going to apply everything I see there to see if that helps.
Send hlcoders mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of hlcoders digest..."
1. Help with strange performance problem (Shokunin)
2. Re: Help with strange performance problem (geotavros)
----------------------------------------------------------------------
Message: 1
Date: Mon, 16 Feb 2015 23:09:45 -0600
Subject: [hlcoders] Help with strange performance problem
<CAOJyTWnH729i+pj+YW7GMifVzbn32Dv9TBDwL0=
Content-Type: text/plain; charset="utf-8"
Hello everyone,
I'm a long time lurker who is on the verge of completing a mod I've been
working on for a couple years. I've run into a very strange performance
problem that has me completely stumped and I think I need some help.
This only occurs on the final chapter of my mod when playing completely
through in one sitting. It's only about 1-1.5 hours so I expect this to be
fairly common. (I hope!) When the final map loads performance drops
dramatically (< 10 fps) due to dynamic light rendering according to the
+show_budget breakdown, but again this only happens when playing through
the whole mod from the beginning (3 map transitions + background map in the
main menu).
There are no env_projectedtexture lights on, no light_dynamics on, and no
normal lights or light_spots with custom appearances on. If the map is
loaded directly there are no performance problems.
Even more strange, by pure luck I've found out by setting the cvar,
r_unloadlightmaps 1, performance is immediately recovered. I can't find any
documentation on what exactly this does and it appears to be an engine cvar
so I can't look at the code to debug. Sometimes leaving that on for 30
seconds then setting it back to 0 keeps the performance, sometimes it needs
45 seconds, sometimes it needs 90, sometimes it needs more.
-Can anyone at valve or on the list help me?
-Would anyone know what exactly r_unloadlightmaps does? It seems obvious,
but I can't see any difference in any of the lightmaps or lighting.
-Can I leave r_unloadlightmaps set to 1 as a work around?
I'm still using Source SDK 2007 since I've added hundreds of code changes
and I really want to avoid switching to 2013, plus I'm basically done at
this point minus this one issue. I've also applied all the code changes to
https://developer.valvesoftware.com/wiki/Env_projectedtexture/fixes
TBH, some of the fixes listed on that page are a bit above my knowledge,
I'm afraid I've created some performance or memory leak that way. Thanks!
Any help would be greatly appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
https://list.valvesoftware.com/cgi-bin/mailman/private/hlcoders/attachments/20150216/829aa4f4/attachment-0001.html
------------------------------
Message: 2
Date: Tue, 17 Feb 2015 11:12:12 +0200
To: Discussion of Half-Life Programming
Subject: Re: [hlcoders] Help with strange performance problem
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Hi,
Sounds like a memory leak. Did you check how much memory is your mod
using over time? If it use a lot of memory it can probably start to use
swap file memory which leads to significant frame rate drop. If your
hard drive indicator is blinking or shining constantly during framerate
drops this is a sign of using the swap file. You can use some profiling
apps to check how much memory your mod is using or may be there is a
concommand for that.
Anyway, if this is a memory leak you'll have to find it and remove.
Hello everyone,
I'm a long time lurker who is on the verge of completing a mod I've
been working on for a couple years. I've run into a very strange
performance problem that has me completely stumped and I think I need
some help.
This only occurs on the final chapter of my mod when playing
completely through in one sitting. It's only about 1-1.5 hours so I
expect this to be fairly common. (I hope!) When the final map loads
performance drops dramatically (< 10 fps) due to dynamic light
rendering according to the +show_budget breakdown, but again this only
happens when playing through the whole mod from the beginning (3 map
transitions + background map in the main menu).
There are no env_projectedtexture lights on, no light_dynamics on, and
no normal lights or light_spots with custom appearances on. If the map
is loaded directly there are no performance problems.
Even more strange, by pure luck I've found out by setting the cvar,
r_unloadlightmaps 1, performance is immediately recovered. I can't
find any documentation on what exactly this does and it appears to be
an engine cvar so I can't look at the code to debug. Sometimes leaving
that on for 30 seconds then setting it back to 0 keeps the
performance, sometimes it needs 45 seconds, sometimes it needs 90,
sometimes it needs more.
-Can anyone at valve or on the list help me?
-Would anyone know what exactly r_unloadlightmaps does? It seems
obvious, but I can't see any difference in any of the lightmaps or
lighting.
-Can I leave r_unloadlightmaps set to 1 as a work around?
I'm still using Source SDK 2007 since I've added hundreds of code
changes and I really want to avoid switching to 2013, plus I'm
basically done at this point minus this one issue. I've also applied
all the code changes to the env_projectedtexture entity as suggested
https://developer.valvesoftware.com/wiki/Env_projectedtexture/fixes
TBH, some of the fixes listed on that page are a bit above my
knowledge, I'm afraid I've created some performance or memory leak
that way. Thanks! Any help would be greatly appreciated!
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
https://list.valvesoftware.com/cgi-bin/mailman/private/hlcoders/attachments/20150217/9b7f459e/attachment-0001.html
------------------------------
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
End of hlcoders Digest, Vol 46, Issue 3
***************************************
Loading...