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.
Related
I recently upgraded to Branch Unity SDK version 0.6.5 from https://github.com/BranchMetrics/unity-branch-deep-linking-attribution/releases and facing session initialization issues. which was working fine before.
On Android, if when the app opens from a deep link the callback is giving error: "Session initialization already happened. set intent extra, "branch_force_new_session", to true."
I need to retrieve link metadata to display the desired UI. So, I need the link properties.
Anybody faced this before? any fix?
Seams like you are initialising the SDK twice.
Are you initialising it in your onStart() and then trying to read the data with some other function that uses the initSession() method? If so, remove the first initialisation.
If you still have the issue, kindly share your implementation of initialisation and reading of link deeplink data from the link.
I'm using react-native-code-push for my app.
I had released several versions that change only a few of js bugs, which worked fine.
Recently I realized that if a code pushed release involves any change of native code other than javascript, the app crashes while updating. I added several react native packages that need manual linking such as react-native-maps, and released update to some targeted versions hoping them to take those, but no luck.
Then what if an update only involves adding light libraries (using npm install) which don't require native linking? I wonder to what extent exactly the code push allows client-side code updating.
Basically, when you want to add some native code involving link you will have to rebuild your apk / ipa and re-upload it to the stores. If you want to add a new plugin without link there should not be any problem
One advice I could give is to only push bug fixes to your production app. You should not push new features with codepush since apple review (almost) all the applications.
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
How can I create automated user interface tests for a Titanium app? Does the framework include something for this? Are there any helpful third party tools?
Have you looked at titanium-jasmine?
I have never personally used it but ive heard its pretty useful for this type of thing. I'm not sure about its abilities to test actually visual elements.
EDIT:
For testing the user interface and simulating touch events on the simulator or device, just use UIAutomation with the native workflow! Since every Titanium project compiles to an XCode project (which can and should be at least profiled for memory leaks using the native workflow before release to the app store), you can just follow the steps here to write your own tests in Javascript.
As a first step, run your app in the simulator, then got to PROJECT_HOME/build/ and open up the xcodeproj file. Once inside XCode, hold down the "Run" button, click "Profile", which will open up "Instruments" and add the "Automation" widget like in the link I provided!
This is not titanium specific, it can be used for any iOS app and seems like a great tool for every iOS developer, along with Allocators and Memory Leak widgets inside of instruments.
Possibly a better alternative is using Gorilla Logic's free MonkeyTalk. It is a bit more straightforward if your not very experienced with XCode, and it has the benefit of (theoretically) being able to test iOS and Android.
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