Team Fortress 2 Forum

This is a community forum and not official technical support. — If you need official support: Contact Us

The following comments are owned by whoever posted them. We are not responsible for them in any way.

Back to Threads Reply to Thread

Heapsize of 2 gig doesn't work - is there a limit?

I'm running TF2 with the command line option -heapsize 1048576. My machine actually has 4 gigs, but if I set -heapsize 2097152 (2 gigs, half my system memory which is the recommended setting), I get to the title screen and menu then the game crashes. Any ideas why this isn't working?

Thanks.

Most likely the 32 bit per process address space limit of 4GB.

A 32 bit process can address a max of 4 GB(2^32). On Linux, there is a 3/1 memsplit by default, which means that userspace has 3 GB of those 4, and 1 GB is used internally in the kernel. On Windows, it is 2-2 by default. We are emulating the 2-2 split by mapping the area of 2-3 GB to /dev/null. This way no pointer appears in this area. Some applications accidentally cast pointers to signed integers. If apps do that, any pointer to an address > 2 GB will get corrupted. It's not a big deal because on windows apps don't get such pointers anyway due to the 2-2 split, but we have to emulate this behavior.

In the remaining 2 GB, you have a few areas reserved for things like 16 bit DOS stuff. Linux/Mac libraries in the process are loaded there. The game .exe and DLLs are loaded there, and any physical memory allocated by the game or any libraries are mapped there. Usually the graphics driver claims some space as well to map the video memory.

So the bottom line is that of the 4 GB, 2-3 GB are consumed by memory management constraints, drivers, CrossOver, the game's executables, Linux/Mac system libraries etc.

That said, if the 32 bit version of TF2 works with a 2 GB heapsize on Windows, but not on CrossOver, it could be a CrossOver bug which we should fix.

Is there any particular reason to play with the heapsize, other than "some tuning guide recommends it"? Has anyone done any benchmarking? Also keep in mind please that CrossOver users MacOS'/Linux's memory management, so not all things said in tuning guides focused on Windows are true on CrossOver. Most of them are, because it is still the same game, but some things depend on the OS as well.

I must admit that I don't understand all of the details of your reply, but thank you for considering my question and giving a thorough answer.

In my own investigations using Boot Camp and XP on the same 4Gb iMac, I've come to learn that XP has a 3Gb limit (see http://www.dansdata.com/askdan00015.htm if you'd like to know the full, grizzly details), and that TF2, HL2 and Portal will run with a heapsize of up to 1.5Gb but no more. This makes sense in Windows as it's half of the system memory, which is the recommended setting; and yes, that's from "some tuning guide" 😊

I can run these games with a 1.5Gb heapsize in Crossover too, which suggests you've emulated / recreated the Windows experience perfectly, arguably a little too well! Now I wonder if this a limit of the Source engine, in which case, the case is closed, or if it can actually handle more memory. If so, and if you could make this possible, you may be in the interesting position of enabling people to run Windows games with more heapsize - and if that tuning guide is right, better performance - than in XP on the same machine.

Update: I got the heapsize up to 1960Mb (in Crossover and XP) with the command line option "-heapsize 2007040". I can't tell how much it's affecting the performance, perhaps someone else would like to benchmark it.

CrossOver Forums: the place to discuss running Windows applications on Mac and Linux

CodeWeavers or its third-party tools process personal data (e.g. browsing data or IP addresses) and use cookies or other identifiers, which are necessary for its functioning and required to achieve the purposes illustrated in our Privacy Policy. You accept the use of cookies or other identifiers by clicking the Acknowledge button.
Please Wait...
eyJjb3VudHJ5IjoiVVMiLCJsYW5nIjoiZW4iLCJjYXJ0IjowLCJ0enMiOi02LCJjZG4iOiJodHRwczpcL1wvbWVkaWEuY29kZXdlYXZlcnMuY29tXC9wdWJcL2Nyb3Nzb3Zlclwvd2Vic2l0ZSIsImNkbnRzIjoxNzMxNDM1MjAzLCJjc3JmX3Rva2VuIjoiQmZWemtFcmZTYVduUnE4UyIsImdkcHIiOjB9