Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on start on OSX with v2.0.9 #838

Closed
anthonyalayo opened this issue Jan 14, 2024 · 1 comment
Closed

Crash on start on OSX with v2.0.9 #838

anthonyalayo opened this issue Jan 14, 2024 · 1 comment

Comments

@anthonyalayo
Copy link

anthonyalayo commented Jan 14, 2024

Hey there,

Thanks for the great work on the project.

I recently tried to upgrade from v2.0.6 to v2.0.9, and I am seeing a crash on startup.
This is running on OSX with an ARM processor.

I pull in mimalloc through cpm:

cpmaddpackage(
  NAME mimalloc
  GITHUB_REPOSITORY "microsoft/mimalloc"
  GIT_TAG v2.0.7
  OPTIONS
  "MI_BUILD_SHARED ${BUILD_SHARED_LIBS}"
  "MI_BUILD_STATIC ${BUILD_STATIC_LIBS}"
  "MI_BUILD_OBJECT OFF"
  "MI_USE_CXX ON"
  "MI_OSX_INTERPOSE OFF"
  "MI_OSX_ZONE ON"
  "MI_BUILD_TESTS OFF"
  "CMAKE_UNITY_BUILD OFF"
)

And I'm using the values of MI_OSX_INTERPOSE and MI_OSX_ZONE based on another issue: #343

Here is the error:

Exception: EXC_BAD_ACCESS (code=1, address=0x100)

Here is the stack trace I am encountering:

std::__cxx_atomic_load<…>(const std::__cxx_atomic_base_impl<…> *, std::memory_order) atomic:1010
std::__atomic_base::load(std::memory_order) const atomic:1643
std::atomic_load_explicit<…>(const std::atomic<…> *, std::memory_order) atomic:2020
mi_free(void *) alloc.c:538
free(void *) alloc-override.c:135
decltype(static_cast<void (*&>(fp)(static_cast<char*>(fp0))) std::__1::__invoke<void (*&)(void*), char*>(void (*&)(void*), char*&&) type_traits:3918
std::__invoke_void_return_wrapper::__call<…>(void (*&)(void *), char *&&) invoke.h:61
std::__function::__alloc_func::operator()(char *&&) function.h:178
std::__function::__func::operator()(char *&&) function.h:352
std::__function::__value_func::operator()(char *&&) const function.h:505
std::function::operator()(char *) const function.h:1182
std::unique_ptr::reset(char *) unique_ptr.h:318
std::unique_ptr::~unique_ptr() unique_ptr.h:272
std::unique_ptr::~unique_ptr() unique_ptr.h:272
c10::demangle(const char *) Type_demangle.cpp:40
c10::demangle_type<…>() Type.h:19
__cxx_global_var_init() generated_ops.cpp:42
_GLOBAL__sub_I_generated_ops.cpp generated_ops.cpp:0
invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const 0x0000000191bbf7c4
invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const 0x0000000191c04214
invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const 0x0000000191bf7524
dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const 0x0000000191ba42d8
dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const 0x0000000191bf6548
dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const 0x0000000191c03bf4
dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const 0x0000000191bbf69c
dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const 0x0000000191bbf950
dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const 0x0000000191bbfae8
dyld4::APIs::runAllInitializersForMain() 0x0000000191be24b8
dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) 0x0000000191ba8dd8
start 0x0000000191ba7dc4

For context, I am currently building this as a shared library. It sounds similar to this issue: #437

Would anyone know how to fix it?
Thanks!

@anthonyalayo
Copy link
Author

I got everything working using the object library, so I'm pretty sure the issue was linking order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant