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
[TIMOB-24389] : iOS Appcelerator Titanium App Crashes after some usage time #8853
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My use-cases worked, although I'm still curious why the app would cause because of a memory issue without calling the didReceiveMemoryWarning:
before, which would be a much better place for this method.
iphone/Classes/MediaModule.m
Outdated
[self sendPickerSuccess:dictionary]; | ||
|
||
#ifndef TI_USE_KROLL_THREAD | ||
//TIMOB-24389 : iOS: Appcelerator Titanium App Crashes after some usage time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the issue rather then paste the ticket title. That will help others to get the details more quickly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote small note about problem. In ticket I think most of the things are explained.
iphone/Classes/MediaModule.m
Outdated
//TIMOB-24389 : iOS: Appcelerator Titanium App Crashes after some usage time | ||
KrollContext *krollContext = [self.pageContext krollContext]; | ||
[krollContext forceGarbageCollectNow]; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to dispatchCallback:
instead, so it's ensured to be called for video capturing & editing as well? Or do you see down-sides there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No side effect. Moved to dispatchCallback.
iphone/Classes/MediaModule.m
Outdated
@@ -1441,6 +1441,9 @@ -(void)sendPickerSuccess:(id)event | |||
[NSThread detachNewThreadSelector:@selector(dispatchCallback:) toTarget:self withObject:[NSArray arrayWithObjects:@"success",event,listener,nil]]; | |||
#else | |||
[self dispatchCallback:@[@"success",event,listener]]; | |||
//TIMOB-24389 : As memory flushing was taking more time, so memory was growing continuously causing crash of app. | |||
KrollContext *krollContext = [self.pageContext krollContext]; | |||
[krollContext forceGarbageCollectNow]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still only executed in sendPickerSuccess
. The method saveCompletedForImage:
and others create a blob as well, are there no leaks there? And change the comment to this:
// TIMOB-24389: Force the heap to be GC'd to avoid Ti.Blob references to be dumped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch dude. Made changes.
LGTM, CR approved! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR passed, using:
MacOS 10.12 (16A323)
Studio 4.8.1.201612050850
Ti SDK 6.1.0
Appc NPM 4.2.8
Appc CLI 6.1.0
Alloy 1.9.5
Xcode 8.2.1 (8C1002)
Tested using the provided sample code by taking over 50 pictures in the app, built with main-thread enabled and disabled. No crash was encountered unless JScore was also enabled. This will be addressed by another ticket/PR.
@vijaysingh-axway Can you do the 6.0.x backport? Will check tomorrow morning Europe time then. Thx! |
https://jira.appcelerator.org/browse/TIMOB-24389