Search Issue Tracker
Won't Fix
Won't Fix in 2023.3.X
Votes
0
Found in
2021.3.31f1
2022.3.11f1
2023.1.16f1
2023.2.0b12
2023.3.0a8
Issue ID
UUM-52888
Regression
No
Memory leak when using NetworkInterface.GetAllNetworkInterfaces
How to reproduce:
1. Open the attached project "testiphlpmemleak.zip"
2. Enter Play Mode
3. Open Analysis>Profiler
4. Select the "Memory" tab in the Profiler window
Expected results: "Unknown" memory is not increasing
Actual results: "Unknown" memory is increasing
Reproducible with: 2021.3.30f1, 2022.3.10f1, 2023.1.14f1, 2023.2.0b10, 2023.3.0a6
Reproducible on: Windows 10 22H2
Not reproducible on: No other environment tested
Comments (2)
-
destenson-dft
Feb 14, 2025 17:25
"We expect that this API method will not be called often during a process."
Unfortunately, this leak is actively causing us problems, since we have an application that runs for months & needs to update the network state often.
-
destenson-dft
Sep 05, 2024 18:30
Did Unity investigate the cause of the leak or just conclude it isn't important for the vast majority of users?
I have recently done a bit of a deep dive & found it's most likely to be caused by code like line 56 here: https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterface.cs#L56
The ptr returned by Marshal.AllocHGlobal(len) on that line is never Marshal.FreeHGlobal(ptr) freed. It seems pretty straightforward to add the call to free the memory before returning.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
We are not planning to correct this leak. We expect that this API method will not be called often during a process.
Resolution Note (2023.3.X):
We are not planning to correct this leak. We expect that this API method will not be called often during a process.