- Posts
- 94
- Likes
- 116
My os is windows 10 and I noticed that MB II allocates huge amount of windows handles, but does not release them. This does have impact on the actual game, because a very high number of assigned handles causes the WMI provider service to go into overdrive and use a lot of CPU.
In my case, I noticed this issue a few days ago, because the game became very unresponsive (even though the game showed I have 90 FPS - my set max, it was laggy as if I had about 15 fps). Checking the task manager showed that the WMI provider was taking about 40% of my CPU. After some googling I came upon the idea of checking how many handles are currently in use by various processes.
I did not make screenshot at that time, but these were the top three processes when ordered by handle count:
Third place was taken by dropbox with ~5800 handles
Second was System process with ~6100 handles
First was mbii.x86 with ~360.000 handles
I am not sure what the cause is, so here's some info from my system and some tests that I did.
System info
Tests
Opening the game to main menu had the game allocate ~1800 handles.
Next, I joined an empty server (tried open mode server with mb2_deathstar, later tried empty duel mode server with mb2_duel_dotf).
Even later, I joined populated server.
These are the test cases that I tried:
So from what I gather, most leaks happened when I was running (and only running) around the map, then when visual/sound effects (from fire nade) and special effects ( UI flame effect) were active.
Switching auto-recording off does not seem to have impact - if anything, I would have expected slower handle leak with auto-recording off. My guess for the 90 handle leak is due to what I (and other players) were doing during the round.
I used the following powershell function to count the handles and just called it manually:
Gathering data for test cases 1.-6. above took me about 52 minutes. During that time, the game allocated 161.904 handles total.
Also for comparison, I played other games - WoW, The Outer Worlds and Factorio:
In my case, I noticed this issue a few days ago, because the game became very unresponsive (even though the game showed I have 90 FPS - my set max, it was laggy as if I had about 15 fps). Checking the task manager showed that the WMI provider was taking about 40% of my CPU. After some googling I came upon the idea of checking how many handles are currently in use by various processes.
I did not make screenshot at that time, but these were the top three processes when ordered by handle count:
Third place was taken by dropbox with ~5800 handles
Second was System process with ~6100 handles
First was mbii.x86 with ~360.000 handles
I am not sure what the cause is, so here's some info from my system and some tests that I did.
System info
- OS: Windows 10 x64
- CPU: Processor Intel Core i5-6660K, 3.50GHz
- RAM: 16 GB (do note that at the time I was doing tests, I still had about 50% RAM free)
- I do not use any replacements/addons in MBII, only binds
Tests
Opening the game to main menu had the game allocate ~1800 handles.
Next, I joined an empty server (tried open mode server with mb2_deathstar, later tried empty duel mode server with mb2_duel_dotf).
Even later, I joined populated server.
These are the test cases that I tried:
- In empty server - stay in spectate, not moving/doing anything, with minimized game
- Leaked ~53 handles per second
- In empty server - joining the game as only player, not doing anything
- Leaked ~72 handles per second
- In empty server - joining the game as imp on deathstar, running circles around Falcon
- Leaked ~89 handles per second
- In empty server - joining the game as imp on deathstar, throwing fire nades around me
- Leaked ~63 handles per second
- In empty server - joining the game as imp on deathstar, throwing and dying to fire nades
- Leaked ~80 handles per second
- Swapping back to main menu
- No leaks, actually total handle count went down by 8 handles
- Joining populated server
- Leaked ~75 handles per second
- Joining populated server, turning auto-recording off
- Leaked ~90 handles per second
So from what I gather, most leaks happened when I was running (and only running) around the map, then when visual/sound effects (from fire nade) and special effects ( UI flame effect) were active.
Switching auto-recording off does not seem to have impact - if anything, I would have expected slower handle leak with auto-recording off. My guess for the 90 handle leak is due to what I (and other players) were doing during the round.
I used the following powershell function to count the handles and just called it manually:
Code:
function Foo
{
param(
$delay = 60,
$process = 'mbii.x86'
)
Write-Host "Starting handle count test for process `'$process`' ($(Get-Date))..."
$handleBefore = (get-process $process).Handles
Write-Host "Waiting for $delay seconds..."
Start-Sleep $delay
$handleAfter = (get-process $process).Handles
$diff = $handleAfter - $handleBefore;
$leak = $diff / $delay;
Write-Host "Finished. Test results:"
Write-Host " Handles at start: $handleBefore"
Write-Host " Handles at end: $handleAfter"
Write-Host " Difference: $diff"
Write-Host " Leaks per second: $leak"
}
Gathering data for test cases 1.-6. above took me about 52 minutes. During that time, the game allocated 161.904 handles total.
Also for comparison, I played other games - WoW, The Outer Worlds and Factorio:
- WoW had allocated 820 handles after playing for 1 hour and 15 minutes
- The Outer Worlds had allocated 8600 handles after 2 hours
- Factorio had allocated 720 handles after 1 hour