Cache_TryAlloc Error

Started by Igge
21/11/2012 14:54
Page 1 of 1
Igge21/11/2012 14:54(edited 21/11/2012 20:10)

Hi guys,

I'm getting an error I've never seen before when I try to run my map. I post it in this part of the forums because it must have to do with my map since I can play any map but this one. When I try to run the map Counter-Strike crashes and gives me this error message:

Cache_TryAlloc: 13353520 is greater than free hunk

Did some quick googling but they all blame their addons and those who blame the map itself don't say why the error occurs or more importantly, how to solve it.
In case it's an addon issue, all I use is amxmodx with the XJ plugin.

Anyone knows how to deal with this error?

Edit: I've tried to experiment a little.
If I remove the last room (quite a big cave) from the map I can run it without the error.
If I add the last room again but remove almost everything in it, the error appears again with the same number as before, 13353520.
I've tried to add a start up parameter "-heapsize XXX". Tried 512MB, 1GB, 2GB and 4GB without success.

/Rainbow Dash

KarLi mapper22/11/2012 00:34

u tried to start the server with -heapsize 120000 or highter?

Just play around with it and see what works XD

Igge22/11/2012 01:46

Hi KarLi,

Check out the edit, I've tried all sorts of different heap sizes.

I've narrowed the error to an ambient_generic in the last room which plays a 13MB big background sound. Such a big wav file shouldn't cause an error (and doesn't when I compile that room only) but combined with entities from the other parts of the map I guess my total entity size is too big or something. However, the compiler runs without problems.

Would be awesome if anyone could tell how the entity size affect the HL engine. Since there's a pretty low limit of entities there has to be a size limit as well. Guess I'll continue searching tomorrow.

byob mapper22/11/2012 06:54

Cache_TryAlloc: 13353520 is greater than free hunk

Sounds really familiar with the 13mb of your sound file. Maybe precaching has an internal limit which this size gets over. Does your map have other notable precached stuff like models, sprites or other sounds? If that's the case then those combined with the big wav should be the problem.

Igge22/11/2012 11:48

Hi byob,

Thought about that number myself after I had written the reply. It's funny, in the wav file properties it says:
size: 12,7 MB (13 353 580 bytes)
It's damn close.
The map has a couple of trees, 75-240 drawn polys per tree. I only use two sprites for fire.
I have more ambient_generic yes. Bird sounds with sizes ~3MB, ~2MB and 500kB. Also a couple of water related sounds and two different fire sounds but none of those are big (~100kB).
Yesterday I tried to remove all bird sounds in hope to reduce the total size but I still got the error.
I will try other wav files today, slowly going down in size. Sure my wav is 13MB but it's a 21 min long song which sounds pretty much the same all way through. If it works with lets say a 8MB wav file I can easily solve the problem by cutting my own wav file.
Only annoying thing when testing is that it takes about an hour and a half to compile :(

You seem to be right that the number shown in the error is related to the wav file size. I hope someone else can tell more exactly why it occurs.

byob mapper22/11/2012 13:51(edited 22/11/2012 14:24)

I would certainly cut down some size from the WAV file for sure. 21 minutes is too long for a cs map of any kind. Try making it 12 mb to start with and see if it fixes.

About compiling you can certainly make a quick compile without rad to test if the sound works or not. Hope this helps further.

I'm gonna run some tests on a sample map with various wav sizes to determine the precache limit today.

edit: Did a few quick tests. With a single WAV file, highest size it could precache was 24 mb, beyond that it just crashed with alloc error. Then I added 2 more wavs and 2 models. Cumulative size was 40 mb which was successfully precached, beyond that the map was not giving an error but simply lagging to death.
So my conclusion is that a single precached unit has a certain limit, total precaches doesn't but it gives serious side-effects after 40 mbs.

Igge22/11/2012 14:33

Hi byob,

I tried to put a 6,4MB wav file in the end and the map run without any errors. I've cut my wav file down to 5,7MB so after this compile I should be able to run the map with my own sound at the end. Good point there about RAD. I've completely forgot I could just disable RAD before compiling. There's quite a lot of texture lightning so it should help a lot hehe.

I found a confirmation about entity data size limit at Valve's dev community. It says:

The combined size (in bytes) of a map's entity data should also be considered, even if the number of entities is within safe limits. Large amounts of entdata can take a noticeably long time to transmit from server to client, and Confirm: may lead to crashes.

The interesting question is how big this limit is. Also, one may be able to tell the entdata of sounds, sprites and models but how on earth do you estimate the entdata of stuff like func_wall, func_illusionary, all timer entities and all entities added during the compile process?

About your tests, it sounds reasonable but looks like my error occured the other way around. I could successfully run my map with the 13MB wav file in it but once I added more entities, my game crashed. Or did you try one map with only the 24MB wav file and one with 2 smaller wavs + models?

byob mapper23/11/2012 02:47

What I did was 1 map with a 24 mb WAV that crashed beyond and a map with 3 smaller WAVs that however reached 40 mb before crashing.

As for the entdata size of entities like the ones you described should really be the info that are on the fields in Hammer (Name, Target, Pitch Yaw Roll, Render FX/Value etc) so those entities actually don't take up too much of the precache in terms of memory size. Kilobytes at most for the largest of maps if I'd estimate.

So, bottom line, don't use huge sounds in a map or huge resources of any kind for that matter. It's unnecessary use of available game allocated memory.

Igge23/11/2012 11:26

I totally agree to that conclusion.

Thanks for the help byob!

Page 1 of 1

Please log in to post replies.