Jump to content
ruPal

Lockless Memory Allocator and Fred41 version of TBBmalloc

Recommended Posts

There are two requests:

1. Provide lockless memory allocator with other DLL's. Why not? There are several malloc's distributed with game and lockless 
2. Repeat fred41's modification for latest version of TBBmalloc. I am noob in that field but can say that Fred41's malloc still the best in performance, hope that his tweaks will give even more FPS with new TBBmalloc version.

Share this post


Link to post
Share on other sites

I have no idea what 1. is, but I'm all in favour of 2. :)

Share this post


Link to post
Share on other sites

1. DYI, the moment we can experiment with all the allocators in world by our-self would mean there is nothing else to do on game

2. maybe only for the Large Pages part (it's in-plan w/o ETA for now)

 

for his other allocator tweaks I'm not sure if it's possible as the latest several private build were w/o any details shared

and while there're some individuals claiming to have those sources/methods, none shared sources/methods with us ...

 

so far we tested only compiled allocator with SSE2 switch (on my dropbox as part of performance build tests) which seems to translate to smoother object loading for some users ...

Share this post


Link to post
Share on other sites

Thank you, Dwarden. I have tested your version of malloc and it is a pity but it worse than fred41 version with LP enabled. Hope that some day you release newest tbbmalloc with his changes. It is a pity that his work was made more than a year ago, gives better performance and still not implememted into the game. I didn't try his latest work (with changes made into arma3.exe) but LP works fine.

Share this post


Link to post
Share on other sites

With fred´s malloc tweak its a difference like night and day in sp and mp. Without I get in mp (same full server, same layout, same spots)  often 24fps minimum, fred´s large pages enabled Its never below 37fps :)

Share this post


Link to post
Share on other sites

With fred´s malloc tweak its a difference like night and day in sp and mp. Without I get in mp (same full server, same layout, same spots)  often 24fps minimum, fred´s large pages enabled Its never below 37fps :)

 

Without any impact on stability ?

Share this post


Link to post
Share on other sites

I don't remember any stability problems. I do remember a couple of extra FPS.

Share this post


Link to post
Share on other sites

Still gets me ~2 more FPS, which I then burn on ReShade/RealLight.

Share this post


Link to post
Share on other sites

What's the best install procedure for fred´s malloc tweak ?

Share this post


Link to post
Share on other sites

What I do/did, largely from memory, no liability accepted, follow at your own risk...

 

Large Page Support (not compatible with BattleEye)

 

- Get the LP Manager helper (https://github.com/fred41/GimmeMoarFrames/tree/master/GimmeMoarFrames/LPManager), save it to your A3 folder and mark it as needing to run 'as Administrator'.

 

- Run the helper ('as Administrator') and enter your Windows account username in the textbox and click the Privilege button next to it.

 

- Place a check mark in LP ImageFileMapping Client (+patch). This will create a patched version of arma3.exe called arma3lp.exe in your A3 folder. I've marked this executable as needing to run 'as Administrator' also. This is the executable you need to run to get large page support (but not with BattleEye).

 

- Restart your PC.

 

- Each time Arma is updated you need to run the helper again, clear the check mark (removes arma3lp.exe), then re-check it (creates a new patched arma3lp.exe).

 

Custom Allocator (works best/only on 64 bit OS, with at least 8GB RAM)

 

- Get the malloc DLL (https://github.com/fred41/tbbmalloc_arma/tree/master/binary) and place it in ...\Arma 3\DLL (I renamed it tbbmalloc_fred41.dll).

 

- Add -malloc=tbbmalloc_fred41 to your arma3lp.exe command line. This gets you Fred's customized memory allocator. I believe you can use this part without large page support and the regular arma3.exe (so BattleEye is OK) but I don't imagine you'll see the same gains.

 

- To confirm it's working check the malloc_????.log file(s) created in the Arma 3 root. You should see; "SeLockMemoryPrivilege: granted, huge pages enabled" (I seem to recall to get this I had to mark the arma3[lp].exe as needing to run 'as Administrator').

  • Like 2

Share this post


Link to post
Share on other sites

I tried the fred41 malloc and gained almost 10% fps (104/95) on Altis.

But soon afterwards (1-5 minutes?) my performance plummeted to less than 20 fps.

So I've switched back to the default malloc.

Although it offers lower fps, it doesn't seem to saturate like fred41.
Any ideas why?

Share this post


Link to post
Share on other sites

I tried the fred41 malloc and gained almost 10% fps (104/95) on Altis.

But soon afterwards (1-5 minutes?) my performance plummeted to less than 20 fps.

So I've switched back to the default malloc.

Although it offers lower fps, it doesn't seem to saturate like fred41.

Any ideas why?

It happens to you and everyone who really plays this game, in fact I am pretty sure that's why developers have dropped the support in to Fred's malloc.
Large pages can in fact improve performance in some situations, but applications that have an intensive memory usage (which is the case of ARMA 3) are prone to performance degradation when using large pages.
This is known since the beginning of the times.

Share this post


Link to post
Share on other sites
Memory is a bit of a complicated subject, I dont know if I can put this in way that everyone can understand, but I will try.

In first place, memory is the place where the data is stored to be accessed by the CPU and consequently by the GPU. There 2 types of memory, Physical (RAM) and Virtual (Page File). 

Physical is the one that we have available provided by our memory (hardware modules).

Virtual is the one provided by the Operative System. managed by the Hard Disk (and stored in Hard Disk) for when we need more memory than the Physical (memory modules) that we have available can provide.

Just be aware that when the application starts to use virtual memory (page file) the performance is not even close from the one provided by the physical memory, no matter the architecture of the memory and/or hard drive, it is always worse.

I am not going to explain why since is a bit complicated, but if you look at your Motherboard architecture you'll understand the differences between RAM and Hard Disk in matters of communication speed to the CPU.

 

Now physical memory (RAM) performance.

There are 2 factors, speed (frequency) and latency (known my CAS). Speed or frequency is the time that RAM takes to process the data, Latency is the time that RAM takes to send and receive in to CPU and vice versa.

Means that a high frequency at higher latency does not provide by itself a better performance.

I'll try to put this simple so everyone can understand.

Let's say that you are playing a online game which has the netcode server side based. and you have a nice machine that can give to you 300 FPS, but you are playing in a server where you have a latency of 500 ms.

You have a nice performance with game but when you join to that server you have lag (delay), why is that? Just because having the game a netcode server based you have to wait for your packets to travel in to server and then, after processed, the server will return the packet to you. This with a ping of 500 ms obviously cause delay (lag), and consequently inaccurate output no matter the performance of your local machine or the server itself.

The same applies to RAM, when you have it running at higher frequencies theoretically it would give better performance but then when you have it also with higher latencies that maybe not true. just because, even the data can be processed faster, your CPU will take more time to receive it and send it back. Also this affects GPU performance because it is the third factor in the chain, let's say.

That's why a DDR3 at 1600 CAS 7 provides basically the same performance of a at 3200 DDR4 CAS 15, despite the differences in architecture.

 

Now Large Pages.

Large Pages are applied only in to physical memory (RAM) and are only effective when your system has RAM enough and do not need to use Virtual Memory, otherwise it will be more like a placebo. For a game like ARMA 3 I will say that at least 16GB of RAM are needed to effectively use Large Pages, otherwise memory management will mainly rely on Virtual Memory (page file) which is provided by the Hard Disk (under this situation a fast SSD will help more than the fastest RAM).

 

With Large Pages enabled basically we are increasing more than 1000 times the size of the data chunks that are being processed, refreshed and flushed (RAM) and accessed by the CPU and consequently by the GPU. In a game with ARMA 3 architecture which heavily relies on memory in matters of data (storage and processing) there is no way for the chunks of data with this size to be processed within acceptable timings.

That's why after some time (when these chunks start to be refreshed/flushed) we have a degradation in performance, mainly because because the CPU (and consequently the GPU) are stopped waiting for the data.

 

Hope it is clear for everyone.

Share this post


Link to post
Share on other sites

 

 

Large Page Support (not compatible with BattleEye)

 

According to logfile large page support is enabled when I use arma.exe with battleye.

Share this post


Link to post
Share on other sites

According to logfile large page support is enabled when I use arma.exe with battleye.

I dunno, maybe BIS has re-enabled it. As I read Fred's documentation it used to be enabled by default then BIS changed it which necessitated patching of the exe. Possibly no longer required.

Share this post


Link to post
Share on other sites

According to logfile large page support is enabled when I use arma.exe with battleye.

How did you make it work. If I enable Image File Execution Options for arma3, the game will crash the second I start the game. The malloc log shows LP is enabled though.

Share this post


Link to post
Share on other sites

Hi jerminhu,

 

please read at first here, scroll down to "How to use": https://github.com/fred41/tbbmalloc_arma

 

These two points are important:

 

"Make sure your arma user account has this privilege set in your local security policies settings (secpol.msc, restart required).
If your useraccount, which you use to start arma, is member of the administrator group, you have to start arma as administrator!"

 

The complete target line of my arma3battleye.exe is:

 

"F:\Steam\SteamApps\common\Arma 3\arma3battleye.exe" 0 1 -nologs -nopause -nosplash -world=empty -noFilePatching -malloc=tbbmalloc

Share this post


Link to post
Share on other sites

Hi jerminhu,

 

please read at first here, scroll down to "How to use": https://github.com/fred41/tbbmalloc_arma

 

These two points are important:

 

"Make sure your arma user account has this privilege set in your local security policies settings (secpol.msc, restart required).

If your useraccount, which you use to start arma, is member of the administrator group, you have to start arma as administrator!"

 

The complete target line of my arma3battleye.exe is:

 

"F:\Steam\SteamApps\common\Arma 3\arma3battleye.exe" 0 1 -nologs -nopause -nosplash -world=empty -noFilePatching -malloc=tbbmalloc

 

I've read the instruction. @jumpinghubert said that he can have large page working with battleye using arma3.exe. I was wondering how he made it because I couldn't.

Share this post


Link to post
Share on other sites

^ There was maybe something about Windows versions. Can't really remember well.

Share this post


Link to post
Share on other sites

The complete target line of my arma3battleye.exe is:

"F:\Steam\SteamApps\common\Arma 3\arma3battleye.exe" 0 1 -nologs -nopause -nosplash -world=empty -noFilePatching -malloc=tbbmalloc

Are you saying you use arma3battleye.exe to start the game instead of the launcher? I didn't know I could do that!

What do the zero and one in the beginning of the command line do?

Update: My user account is a member of the Administrator group, so I need to launch arma3 as administrator. However, when I run the shortcut of arma3battleye.exe as administrator, battleye will start normally, but arma3.exe won't start.

Update #2 Fixed by disabling gimmemoarframes.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×