You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This way nameToKindMap implicitly gets extern linkage. So during the linking stage, the linker will resolve references to nameToKindMap in MGLTypedArray.cpp to the definition in TypedArray.cpp which leads to "pointer being freed was not allocated" error when the app is closed.
Fix idea:
Use different global object names. I.e. rename nameToKindMap to smth like nameToKindMapMmkv in react-native-mmkv
Use static with nameToKindMap in react-native-mmkv
Get rid of global unordered_map by adding if statements in getTypedArrayKindForName
I personally fixed it by adding static to nameToKindMap definition
The text was updated successfully, but these errors were encountered:
KirillRodichevUtorg
changed the title
iOS crash: malloc: *** error for object 0x282611260: pointer being freed was not allocated
iOS crash: malloc: *** error for object 0x282611260: pointer being freed was not allocated EXC_CRASH (SIGABRT)
Mar 19, 2024
Env:
Stack:
Description:
When
react-native-mmkv
installed alongside withreact-native-quick-crypto
, iOS app crashes when closed.Root cause:
Both
react-native-mmkv
andreact-native-quick-crypto
implementnameToKindMap
inTypedArray.cpp
andMGLTypedArray.cpp
correspondingly.This way
nameToKindMap
implicitly getsextern
linkage. So during the linking stage, the linker will resolve references tonameToKindMap
inMGLTypedArray.cpp
to the definition inTypedArray.cpp
which leads to "pointer being freed was not allocated" error when the app is closed.Fix idea:
nameToKindMap
to smth likenameToKindMapMmkv
inreact-native-mmkv
static
withnameToKindMap
inreact-native-mmkv
getTypedArrayKindForName
I personally fixed it by adding
static
tonameToKindMap
definitionThe text was updated successfully, but these errors were encountered: