I have a three.js website which when loaded in mobile safari on iphone takes up ~450mb(I found this through "Instruments" utility in XCode).
Now, when I reload this page, the inspector shows that the memory is now ~550mb. And, the next time I reload the page, it crashes altogether(probably due to crossing the memory limit of 640mb?)
I've tried:
Disabling renderer.render calls(three.js sends data from main memory to GPU memory during renderer.render) so nothing is sent to GPU, in this case the memory was ~280mb but still, it was increasing with page reloads.
Disabling caching on the main page.
Freeing up almost all the resources both in main memory and in GPU memory as suggested here.
Set any/all images src to 1px data URL as suggested here.
But, the page still crashes due to increased memory between reloads. So, I am confused as to what keeps the browser from freeing up the memory. Any clues?
Related
i have some questions why my memory consume always increase when present new page but after dismiss not reduce the memory and there are not memory leaks detects
for example :
when first run :
first run image
when present new page:
new page image memory consume
when dismiss the page:
dismiss page image memory consume
i look at Debug memory graph, the Foundation always increase . like this:
first run:
Debug memory graph image first
present new page:
Debug memory graph image present new page
dismiss page:
Debug memory graph image dismiss page
as you can see the Foundation always increase the Heap. so the question why always increase and how we release them ? so the consume memory not increase
example code: https://github.com/tomdwipo/simpleMemory
I checkout your code from Github and I found its a default behaviour in apple iOS.
when we call new screen that time memory get allocated into main memory and when we dismiss screen then its memory objects remain into memory until some other screens or object require memory. This memory management done by apple iOS to get best performance and avoid repetitive memory allocation task.
We can't say this is related to memory leak because in memory leak problem iOS can't deallocate memory object when more memory required by other objects.
I scroll over an infinite scroll page using Puppeteer. As you can imagine, the memory grows and is never flushed. In order to lower the memory need, I decided to remove the loaded DOM every once in a while. While the browser is much faster to scroll, the memory remains the same.
I wanted to know how I can tell Puppeteer to flush its memory when the page is almost empty each time I remove the loaded DOM? Logically, the memory need should be extremely low. Maybe a garbage collection trigger would help? Anything I can do to release the memory?
I have a MVVMCross UWP application.
The first views are not remarkable until the user comes to a welcome page and from there goes to a dashboard.
Here lies a problem, somewhere is a memory leak and I can't find it.
The graphic shows memory usage in MB and navigations from welcome->dashboard and back.
The first section is navigating to a dashboard without an embedded webview, the second section has a webview element which loads a rather complex page with embedded video.
Some notes:
The webview, when enabled is loaded in code behind using the SeperateThread flag and set as the content of a ContentControl
On unloading the view I explicitly set the content of the ContentControl back to null, the temp value to null that holds the webview and manually call GC.Collect. If I do not do this the webview will continue playing the video in the background until the GC kicks in
I use a custom presenter (adding support for popups and to implement and call IDispoable/Dispose for my viewmodels (to not wait for the GC to clear subscriptions and such)
When analyzing memory dumps I can not see any changes in managed objects or memory
There seems to be a problem (a small leak) when not using the webview and I will look into this as well, right now I am more concerned about the second scenario
Where should I continue to ivestigate what is going on?
Thank you!
memory over several hours
EDIT:
Test Application available (see comments)
Just let it run for about 30 minutes to see the problem. Memory will steadily increase slightly until the application crashes (might take a few hours).
I kinda messed up the display and % for the memory usage. just watch application memory in task manager or export a csv file with the raw data
Same progression in sample app
So I have an UIWebView inside an UINavigationController which is inside a UITabBarController, where the UIWebView basically make the whole view.
Inside the UIWebView I'm displaying content from a web-server which grows in height as you scroll down and reach the bottom. After a while, I start getting memory warnings and after some more scrolling, eventually, the whole app crashes with an error message saying Terminated due to Memory Error.
However, I've carefully monitored the memory usage of the app and can't find anything indicating that the app fills the memory or anything like this.
I've also logged the content size of the web views scroll view when I receive the warnings and the hight varies from 30 000 up to 60 000 until I get the first warning. I've also tried running the HTML content without any image elements, didn't make any noticeable difference.
So, what am I missing?
Is the memory being filled somehow, causing the app to crash?
Any suggestions on debug tools/methods I could try?
All tips are most welcome!
Try using paginated web page and you can cache data for pages using NSURLProtocol.
It would load pages and cache onto disk so navigation backward would be from cached and only 1 page would be in memory which is being viewed.
That is best you can do with UIWebView OR you may go for MKWebView it can allow you additional features.
When will i have running my app in simulator. xCode debug section shows cpu and memory section it will display some graph flow. but i don't know what is that.
My question is,
what is that cpu and memory graph
when i running my app the memory increase towards when ever i navigate to any other viewcontroller and return back same or other viewcontroller etc., it always increase the memory size.
why it occurs. Is that any problem. if yes how to fix that and why i caused.
Here below image i navigated to any other view controller. it is suddenly increase from above image memory size to below image memory size.
Well from overall memory consumption it would seem as if you are handling some images or videos or other heavy content. Many make memory leaks handling those. To test if thats a real leak, you can do so:
Go to some page A (any page), from there go to some other page B, then back to A, back to B.. repeat that and if your memory is really getting high - you have a leak.
BUT bear in mind: These graphs show you how much resources your app use from your device, you SHOULD NOT use that to find leaks. Instead go to profiler, choose memory leaks and use that. If you are using ARC and cannot find any leaks, you can use "mark heap" button in allocations instrument to find memory build ups like this: Repeat the "page A page B" cycle and every time you are in page A, press "mark heap" button. You will now see generations which each show how much memory has increased from last generation. If it always keeps increasing same amount - double clicking generation will show you all the places that you have possible leaks.
Additional info: Easiest way to profile your app is to hold left mouse on "play" button in xcode until more buttons pop-up. Choose profile. When instruments appear - choose "Leaks".
From there - you should be able to see overall statistics of your app. I will not go in detail about profiler, because all the info is already available in the net. For example: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html