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

Realm iOS crash - out of memory - Realm or Apple bug? #3111

Closed
cristianoccazinsp opened this issue Aug 5, 2020 · 3 comments
Closed

Realm iOS crash - out of memory - Realm or Apple bug? #3111

cristianoccazinsp opened this issue Aug 5, 2020 · 3 comments
Assignees

Comments

@cristianoccazinsp
Copy link

cristianoccazinsp commented Aug 5, 2020

Sorry for skipping the template, I'm not entirely sure this belongs to realm, or sadly there's another "realm" namespace within Apple's source code.

Can someone tell me if the following crash log is from realm? I will update the issue with the required template info if it is.

NSMallocException Failed to grow buffer 
    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation __CFRaiseMemoryException
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFReallocationFailed
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFSafelyReallocate
    Frameworks/Foundation.framework/Foundation __NSMutableDataGrowBytes
    Frameworks/Foundation.framework/Foundation -[NSConcreteMutableData appendBytes:length:]
    Frameworks/ImageIO.framework/ImageIO IIOImageWriteSession::putBytes(void const*, unsigned long)
    Frameworks/ImageIO.framework/ImageIO iioWriteCallback(void*, int, void*)
    PrivateFrameworks/AppleJPEG.framework/AppleJPEG _aj_ostream_write
    PrivateFrameworks/AppleJPEG.framework/AppleJPEG _aj_block_encode_ac
    PrivateFrameworks/AppleJPEG.framework/AppleJPEG _aj_encode_buffers_baseline
    PrivateFrameworks/AppleJPEG.framework/AppleJPEG _aj_encode_row
    PrivateFrameworks/AppleJPEG.framework/AppleJPEG _applejpeg_encode_image_row
    PrivateFrameworks/AppleJPEG.framework/AppleJPEG _recode_all
    Frameworks/ImageIO.framework/ImageIO IIOImageDestination::finalize()
    Frameworks/ImageIO.framework/ImageIO _CGImageDestinationFinalize
    Tenant Move-In realm::util::FunctionRef<unsigned long (realm::BPlusTreeNode*, unsigned long)>::FunctionRef<realm::BPlusTree<realm::Timestamp>::erase(unsigned long)::{lambda(realm::BPlusTreeNode*, unsigned long)#1}&>(realm::BPlusTree<realm::Timestamp>::erase(unsigned long)::{lambda(realm::BPlusTreeNode*, unsigned long)#1}&)::{lambda(void*, realm::BPlusTreeNode*, unsigned long)#1}::__invoke(realm::BPlusTree<realm::Timestamp>::erase(unsigned long)::{lambda(realm::BPlusTreeNode*, unsigned long)#1}&, realm::BPlusTreeNode*, unsigned long)
    Frameworks/AVFoundation.framework/AVFoundation -[AVCaptureStillImageOutput handleNotification:payload:]
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopDoBlocks
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun
    Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific
    PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal
    PrivateFrameworks/UIKitCore.framework/UIKitCore _UIApplicationMain
    Tenant Move-In _mh_execute_header
    /usr/lib/system/libdyld.dylib _start

Thanks.

@RealmBot
Copy link
Collaborator

RealmBot commented Aug 6, 2020

➤ Lyubomir Blagoev commented:

This seems not related to Realm. Seems like an out of memory exception happening in user code that is executed in a Realm callback.

I will close this ticket. Feel free to reopen it or post a new one if your investigation points to a Realm issue.

@cristianoccazinsp
Copy link
Author

Is the realm callback fired from JS or Native? I see no user code at all in the stack after the realm call, not from any third party library or anything, but rather Apple's own code. Strange :(

@cristianoccazinsp
Copy link
Author

@blagoev I have just opened another issue (#3114), which although not fully related, this very same crash was involved at some point.

I suspect Realm might be leaking memory somewhere (since this is the only library we have upgraded when these crashes started to pop up). The fact that we get the memory exception in a JPEG/Image processing call is just coincidence because the app is used to take ~500 photos / hour, with perhaps 5000 realm operations during this time. It makes sense that the device crashes here because this is the only place it will be requesting a lot of memory.

After this second crash, it is consistent that the app was in fact very low on memory when it happened.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants