I'm using AFNetworking for downloading video file from server. Since my app target on iOS7+, i use method downloadTaskWithRequest:progress:destination:completionHandler:
When i download a large file(400M), the memory detector of xcode seems weird, the memory keeps growing and several Received Memory Warning print in the console, then my app is killed.
But when i profile with Instruments, the allocations of memory seem to be stable.
The app does not crash if i run my app directly without debug, crash only appears when running with xcode.
Is this a bug of xcode? or my app has memory issues(may be memory leaks)??
Update:
Xcode version 7.1.1, iOS8.3, Using Objective-C
Related
Issue
https://github.com/nativescript-vue/nativescript-vue/issues/492
brief synopsis
Using a custom tab-routing strategy in Nativescript-Vue I found that my application was leaking memory. The routing strategy relies on one overarching component that will toggle active components via a v-if statement. When the user navigates to a new page, the v-if statement will hide(and destroy) the old page and show(and mount) the new page. In theory the old page should be destroyed and the memory collected by the garbage collector; however, in practice the memory piles up and never seems to be released from the application, even when calling the garbage collector manually.
testing and reproduction
This issue was tested and found on a real ios device (emulator seems to have no memory issues but I have read that it's not like a real device). The github issue provided above can provide some further detail, and the repository linked below demonstrates a minimal reproduction to cause a memory leak.
A reproduction of this error can be found at https://github.com/geodav-tech/nativescript-vue-memory-leak.
After building the project, run it through xcode, look at the memory profile, and navigate back and forth from the states list to the example list that gets generated on mounted. screenshots also provided within readme
I expect the memory of the hidden components to be cleaned up after they are destroyed and currently even if you leave the app open for several minutes the garbage collector does not reduce the load.
question (edit)
Does anyone have any reasoning behind the memory being held by the application? Is there a better way to accomplish a routing strategy similar to this that wouldn't cause a memory leak or is something about the flow of the program a bad strategy?
To anyone facing memory leak issues similar to this, the answer lies in updating.
The projects facing this issue were compiled against:
nativescript ios runtime: 5.0.0
nativescript android runtime: 5.0.0
tns-core-modules: 5.0.2
nativescript-vue: 2.0.0
Updating to the following fixed the issue.
nativescript ios runtime: 5.4.0
nativescript android runtime: 5.4.0
tns-core-modules: 5.4.0
nativescript-vue: 2.2.2
Now the exact same structure is freed up once navigated away from.
I've started to fiddle around with React Native, I followed the directions on the start page exactly. After initiating a new project I opened up the file in xcode and the build succeeded. The test application, which is just a view and some lines of text, seems to rapidly consume memory. After letting it run for 5 minutes it's at 284.5mb of memory used and climbing. This seems wrong. Is there a memory leak here? If so, what could be causing it or how could I track down what the cause is?
I'm using react native version 0.17.
There is no RN version 0.1.7... there is 0.17.0 coming though. You might be seeing the memory leak originally reported in 0.15.0 which should be fixed in the upcoming version 0.17.0. See: https://github.com/facebook/react-native/issues/4538
I have created one application for iPhone. Application does a search for all watersports around the world. It is webservice based application.
My application runs smooth on Simulator without any crash report but when I create ipa file and launch same application on my iPod (I dont have my own iPhone) the application crashes after some time. Scenario of crash is not fixed so I assume this is because of Memory Leak or memory warning.
I used this function didReceiveMemoryWarning to identify memory warning but the function doesn't get called on simulator.
My Xcode version is 4.3 and unfortunately I updated the version of my iPod to iOS 6.0 so I can not test the app by connecting my iPod to the Mac. I am going to update my Mac and Xcode very soon but not soon enough to make this issue resolve/test.
Any ideas?
You can get the crash log from device using the following approaches. Check how-to-find-crash-logs or get-crash-reports-logs-from-iphone-ipad. You can symbolicate the crash log to find out the root cause. Check this question here for more details on that part Symbolicating iPhone App Crash Reports. Once you got the issue, you should be able to fix it.
Try this, put a temporary label then modify it when the didRecieveMemoryWarning is called or make an alert view that pops up when didRecieveMemoryWarning is called.
Also, run with Instruments app, its a great way to monitor your memory usage and identify memory leaks. Also try Product -> Analyze to find memory leaks from in-Xcode. Instruments is part of the SDK just search for it in spotlight.
I'm trying to develop an app using Xcode 4.3.3 with iPhone 5.1 simulator.
When i run this app on simulator, i got no warnings and it's working very well. But,when i try to make this work on iOS device,i got an warning message which is Received memory warnings. I got this warning message while the app starts to display images on the screen. I'm using SDWebImage project which is available in github to display images.I think this problem is releated to how memory organization differs from iOS device to simulator. I have looked this question How does building for iOS device and simulator actually differ? to see how the building app for iOS Device and Simulator differs. But,what i found about memory organization didn't satisfy me. Do you guys have any idea why this is happening ?
Another question : Is there any limitation for an application in the context of memory management? What i mean is, for example let's say 5MB memory is allocated ,will i get any messages which points to this issue ?
Thanks in advance.
You will never get memory warnings in the simulator unless you create them yourself (with the "Simulate Memory Warning" option). You have access to the entire memory of the Mac, including virtual memory. You had better not run out with a mobile app...
If you're seeing memory warnings on device, it means you're using too much memory. The best tool for determining where you're having trouble is Instruments and specifically the Allocations instrument. This will show you what is taking the most memory and where you should focus. Most memory warnings are due to a leak or retain loop.
you should better do not debug with the simulator , because the simulators memory is the mac , but your devices memory is very limit , and the capability of the simulator is better
I have a strange issue, I have developed an app , I analyzed the app from Xcode i.e Xcode>Product>Analyze, then fixed any memory leaks I got. I ran the app in ipad simulator it worked fine, no crash nothing, ran it on an iPad device;no crash no errors nothing.
But when I tried to profile the app from instruments for memory leaks , during profiling there were no memory leaks, but at one stage when I load a modal view and then after Modal view dismissal the app crashes and instrument displays simulator session time out.
What could be the problem ?
If you have any compile conditions, e.g.: #ifdef DEBUG ..., to switch on/off functionality between debug and release this could cause problems since Instruments uses the Release configuration and regular Simulator run uses Debug.