protonscr

[GoldSource] Cache_Alloc / Model cache bug

steamclosed
ValveSoftware/steam-for-linux#1794 · opened 2013-02-15 by tehORiON · updated 2013-02-15 · 2 comments · github
TtehORiON 2013-02-15 github

Hi,

This bug is a longtime present one which has been inherited from the original quake1 source code.

When sprites are loaded in 'Mod_LoadSpriteModel', cache.data get's set for the sprite model. The problem with this is that sprites does not go into the caching system and thus are not cleared properly between the map loads. The sprites will stay in the model-list 'model_t mod_known[MAX_MOD_KNOWN]'. The unique model cache list never goes down (mod_known), so when it reaches it's maximum of 1024, it will try and use some of the old 'free positions'. The problem is that it will think that the position where a sprite resides in is 'free' and try to allocate a new model in this position. This will throw the "Cache_Alloc: already allocated" error and shut down the server.

This can be relatively easily fixed by setting all sprite's cache.data to NULL in the 'Mod_ClearAll' function where all models are traversed and cleared upon mapchange.

XxPaw 2013-02-15 github
Jjohndrinkwater 2013-02-15 github

Nothing extracted yet.