RecyclerView consuming more memory - android-recyclerview

RecyclerView not recycling views don't know whats the issue. But reyclerView not releasing memory while scrolling. its kind of instagram reels type application. After 4-5 scrolls it consumes upto 0.5-1 GB memory and not releases resources even i replace fragments.

Related

iPad iOS memory management - how to free up "Real Memory" used by UIImageViews, UIScrollViews?

I'm having memory issues with one of my apps and I've identified "Real memory" as defined in Instruments> Activity monitor as a possible culprit.
My app allocates large UIImages within UIScrollViews. There's a CIImageFilter applied to one of the images. Activity monitor shows that upon the first pushing of the view controller containing scrollviews with large images, the real memory use jumps to around 300mb. Subsequent pushes/pops raise it to about 500mb:
I read that "Live Bytes" does not count memory used by textures and CALayers, so my question is: How do I properly release memory that is used by CALayers of my Image/Scrollviews?
See the real memory usage blue pie chart on the right:
Both real and virtual memory are the highest for this process:
What bothers me is that I'm trying to clean up my large scrollviews and images when popping that controller, and the numbers for the "Live bytes" go down to about 5mb, while "Real Memory" stays outrageously high(~500 mb):
ContainerScrollView* container = ...;
[container.view removeFromSuperview];
container.view = nil;
Here's the allocations profiling:
I found a person experiencing a similar issue here:
Mysterious CoreImage memory leak using ARC
The answer (I really hope it is) appears to start using NSData dataWithContentsOfFile: and then create a UIImage imageWithData:. Got an image a user picked? Write it to a temporary file and read it back. I do not trust any other image methods, as they, in my 12 hours of testing appear to behave irrationally in iOS 6.1.2 for large image views.

Crashing Ipad app, memory issues

I'm very new to objective C, that's actually my first app...
I'm working on an application which has a list of projects, each project has its own gallery of images, segues וarc. the gallery takes about 90% of the screen, and a row of thumbnail takes the rest.
It is running OK on the simulator, but when I get out of one gallery to another (somtimes after three or four passages) the application crashes (on real device - iPad2 with IOS 6).
There is no exception or error, the log is clean. It seems to crash when the application reaches 350MB of RAM.
I believe there is no memory release between passing trough the galleries, even though I am usingבarc וsegues.
In addition, on the first entry to each gallery, it takes a few seconds for the gallery to load (only on first run, if I exit and reenter the same gallery it enters immidiatly) which seems further clue that it is kept in the memory.
I would really appriciate any idea, even if it simple as this is a first app and I'm not very experienced.
Thanks for your time and help...
I am not sure the exact reason for this is the memory issue. but when you handling the big payload(data) on your project,you have to think about what happen the memory reach the maximum reachable data size allocate for the app at the time.
Thanx for the API you have a call back method when fires the app reach the maximum Data size the system can handle.
- (void)didReceiveMemoryWarning{
// in this metod you can remove(release) additional memory used by your view controller
// in your case UIImage objects of the gallery.
}
You can't call this method directly. it's a system call method.
but you have a option to ask to call method, when you debug in the simulator.
(Simulator Status Bar: -- Hardware > Simulate Memory Warning).
documentation here

Memory warning and crashes, but no leaks

I'm creating an app based on storyboard, where each of the views has quite a lot of large images. The app crashes (not a lot, it usually crashes after 10-15 minutes of intensive use) after having displayed a few memory warning.
I've checked instruments, and it's not reporting any single memory leak. Also, the allocation seems to be reasonable (I've only got 1 or 2 peaks in the game when I load some very xib containing very big images - around 8mo for the iPad retina version).
I don't really have any objects I can release when I receive a memory warning, as all the stuff from the previous view has already been deallocated.
I've seen that similar problem, but it seems to be related to a specific line of code, which is not my case : iOS - App crashing after Memory Warning - Instruments showing no leaks
Is there a way to force xcode to clean the images that are cached?
Otherwise, what can I do to prevent these crashes?
Thanks for your help !
I have had the similar problem, but my solution was at the end easy:
You should think the Iphone is like a car. A car can't speed up to 100 Mph in one second. A Iphone can't load big images in one second. So what you have to do is: you should shrink the size of the images and if there are more than 2 big images on one view just delete one of them or put it to other views.
If that is not your solution look for mistakes in the code and check up, where the app crashes.

Objective-C Cocoa-Touch WebView Memory Allocation doesn't stop rising

Related to this question: Memory leak tool tells me zero leaks but memory footprint keeps rising
I also have a rising memory-footprint, but I don't allocate images, and more importantly, I don't do anything in the background. There's just a UIWebView on the screen, showing a JavaScript-free page. Here are two screenshots from the profiling instrument, one is 10 minutes after the other, with zero interaction and zero background activity:
(NOTE: If I set the Allocation Lifespan radio button on the left on another value, it does no difference. The live bytes have rising by about 6MB within 10 minutes.)
Now my question:
Is this an instruments-bug? Or is the WebView allocating more and more memory? Or do you think it's impossible and that I must have gotten something wrong here?
Aww sorry, there seems to have sneaked in some JavaScript that made the problem. Using a test HTML page, memory remained static.

Release backing layer for a view to reclaim memory?

I have a custom tab widget, with a lot of views whose backing CALayer objects are taking up too much memory. I'm looking at releasing views for background tabs, but it would be simpler if I could just ask the framework to release the backing CALayer (which is where most of the memory is going) and have it re-create it on demand. Is that possible?
Does a nested view hierarchy consume more memory than a flatter one, because there are more CALayer objects, with mostly the same pixels? If a 100 x 100 view takes X memory, does it mean that a 100 x 100 view with a 100x100 subview takes roughly 2X?
Why didn't Apple go with the AppKit model where the programmer controls which views have backing Core Animation layers? That would consume a lot less memory, which is scarce on iOS compared to OS X. Thanks.
All views are layer-backed on iOS and you have no control over this.
You should just release the inactive views and reload them as necessary.
The reason views are layer-backed on iOS is so that the GPU does the majority of the heavy lifting. This massively reduces the CPU load so that the CPU can be used for real work or be throttled down to save power.