Search Issue Tracker
Won't Fix
Votes
1
Found in
2020.3.44f1
2021.3.17f1
2022.2.4f1
2023.1.0b1
Issue ID
UUM-24937
Regression
No
“Thread 1: Deallocation of non-allocated memory” error appears when building an Xcode project with the “Address Sanitizer” setting enabled
How to reproduce:
1. Build the user’s attached “ExportXcode.zip” project
2. In the Xcode project go to Product > Schemes > Edit Scheme
3. Open the “Diagnostics” tab and enable the “Address Sanitizer” setting
4. Build the project and observe the result
Expected result: No errors
Actual result: “Thread 1: Deallocation of non-allocated memory” or “Mono tid_103 (1): Deallocation of non-allocated memory” error appears
Reproducible with: 2020.3.44f1, 2021.3.17f1, 2022.2.4f1, 2023.1.0b1
Reproduced on: macOS 12.4 (Intel)
Notes:
- Not reproducible if not enabling “Address Sanitizer”
- Reproducible with Mono and IL2CPP Scripting Backend
- Reproducible with all compiler configurations (debug, release, master)
Comments (1)
-
ejl103
Feb 22, 2024 18:45
I just hit the same issue trying to setup address sanitiser on mac for our game (where most our code is C++) this is a very important tool for us, would it by possible to have a mode or build which disabled the overloaded operator new etc (& therefore disabled the profiler) so that we can use Asan? obviously it wouldn't be the default.
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
- "IMGUIContainer cannot be used in a panel drawn by cameras." error thrown when adding IMGUI Container in UI Builder > Hierarchy
- Crash on GameObject::RemoveComponentFromGameObjectInternal when opening a specific project
- Sidebar text in Package Manager does not disappear when sidebar is at its minimum size
- The edge of the Terrain is breaking when painting along the edges where the two Terrains connect
- UI Builder Scroll button for Code Preview section automatically selects all of the code
Resolution Note:
Address Sanitizer overload C++ operators new and delete to monitor allocations, while Unity does the same to forward those to it's own memory manager for it's own management and ability report allocations in the profiler.
In the context of executable and multiple shared libraries an asymmetry happens and memory gets allocated using Unity's overloaded new, but deallocated using sanitizers delete.
Disabling Unitys overloads solves the issue, but at a loss of profiler etc. Given that sanitizer is a diagnostic tool, it does not sound justified to remove Unity overloads.