microsoft / microsoft/mimalloc
mi_usable_size: invalid (unaligned) pointer on MacOS Ventura.
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
Good day.
Have problems on MacOS Ventura with mimalloc: "(unaligned) pointer" warning in Debug and segfault in Release.
It seems that mi_usable_size gets pointer not allocated by mimalloc.
Sample code:
app.m
```
#include
@interface MyApplication : NSApplication
@end
@implementation MyApplication
@end
void
Cocoa_RegisterApp(void)
{
@autoreleasepool
{
if (NSApp == nil)
{
[MyApplication sharedApplication];
{
}
}
}
}
int main()
{
Cocoa_RegisterApp();
return 0;
}
```
CMakeLists.txt
```
cmake_minimum_required(VERSION 3.16)
project(test_package)
find_package(mimalloc)
add_executable(test_package app.m)
target_link_libraries(test_package PRIVATE mimalloc::mimalloc)
find_library(COCOA_LIBRARY Cocoa ONLY)
target_link_libraries(test_package PRIVATE ${COCOA_LIBRARY})
```
Debug output:
mimalloc: error: mi_usable_size: invalid (unaligned) pointer: 0x97f86e598e2153a3
mimalloc: error: mi_usable_size: invalid (unaligned) pointer: 0xa0cfe8d603a959b3
mimalloc: warning: mi_usable_size: pointer might not point to a valid heap region: 0x20d54b5b0
(this may still be a valid very large allocation (over 64MiB))
mimalloc: error: mi_usable_size: pointer does not point to a valid heap space: 0x20d54b5b0
Contributor guide
No contributing guide indexed for this repository
Research direction
Build the minimal reproduction from app.m with the CMakeLists.txt configuration and run it on macOS Ventura in Debug and Release. Start at the reported mi_usable_size calls and trace the pointer source; done means the sample no longer produces the invalid-pointer diagnostics or Release segfault.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, macos
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100