android-memory

Android memory management granularity - Activity or Process?

最后都变了- 提交于 2021-02-07 02:47:52
问题 I am seeing inconsistent documentation and discussion regarding what happens when Android is low on memory and the steps the OS takes to re-claim memory. More specifically, does Android kill at the granularity of activity/fragment, or entire process? For example, if Activity B is launched in front of Activity A (and both activities are part of the same app/process), can Activity A be killed by the OS while Activity B is in the foreground and the user is interacting with Activity B (assume:

Android memory management granularity - Activity or Process?

你离开我真会死。 提交于 2021-02-07 02:47:44
问题 I am seeing inconsistent documentation and discussion regarding what happens when Android is low on memory and the steps the OS takes to re-claim memory. More specifically, does Android kill at the granularity of activity/fragment, or entire process? For example, if Activity B is launched in front of Activity A (and both activities are part of the same app/process), can Activity A be killed by the OS while Activity B is in the foreground and the user is interacting with Activity B (assume:

Android memory corruption

馋奶兔 提交于 2020-12-15 06:08:35
问题 I have a very strange bug on Android that I can't explain. Most of the time, my app (made in Delphi with FireMonkey) ends with External exception xx or Access violation at address xxx, accessing address 0000000x and I can't explain why. The exceptions appear in different places of my software, and at very unexpected times. For example, the last error log I receive just now is this one: libapp.so $0000007D91A61548 Grijjy.Errorreporting.TgoExceptionReporter.GlobalGetExceptionStackInfo

Android memory corruption

余生长醉 提交于 2020-12-15 06:08:00
问题 I have a very strange bug on Android that I can't explain. Most of the time, my app (made in Delphi with FireMonkey) ends with External exception xx or Access violation at address xxx, accessing address 0000000x and I can't explain why. The exceptions appear in different places of my software, and at very unexpected times. For example, the last error log I receive just now is this one: libapp.so $0000007D91A61548 Grijjy.Errorreporting.TgoExceptionReporter.GlobalGetExceptionStackInfo

Sharing RAM across android processes when using content provider

倖福魔咒の 提交于 2020-01-14 06:20:24
问题 While going through the android docs for Memory Management, I came across this particular section for Sharing memory across processes. The third point states : In many places, Android shares the same dynamic RAM across processes using explicitly allocated shared memory regions and a very interesting example is given after this : cursor buffers use shared memory between the content provider and client I found this example pretty interesting and would like to learn more about this. As in, how

Why does my 160kb app background become 49 MB at run time?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 22:34:55
问题 I decided to investigate my app's memory usage and I looked at Android Studio's Memory Monitor and my memory usage was around 68 MB. It looks too high to me. I opened memory allocator and started tracking from the beginning of the application. I saw that there is a 49 MB allocation of a NonMovableArray , which is a Bitmap . I debugged the application and found out that it was the background I was using. The lines below are from PhoneWindow.java file, that's where Android assigns the

Why does my 160kb app background become 49 MB at run time?

﹥>﹥吖頭↗ 提交于 2020-01-06 22:29:56
问题 I decided to investigate my app's memory usage and I looked at Android Studio's Memory Monitor and my memory usage was around 68 MB. It looks too high to me. I opened memory allocator and started tracking from the beginning of the application. I saw that there is a 49 MB allocation of a NonMovableArray , which is a Bitmap . I debugged the application and found out that it was the background I was using. The lines below are from PhoneWindow.java file, that's where Android assigns the

Memory heavy oval gradient

那年仲夏 提交于 2019-12-25 08:49:26
问题 As you may know it is not possible to draw an oval radial gradient using regular Android API. This is what I want to achieve: So I implemented this solution: draw a regular radial gradient on a square bitmap and then this bitmap will get stretched by the view itself (idea found here: https://stackoverflow.com/a/3543899/649910) This works great however this solution takes a lot of memory, because of BitmapDrawable usage (see implementation details below). Any ideas on how to avoid usage of

Android: File Reading - OutOfMemory Issue

你离开我真会死。 提交于 2019-12-24 06:36:37
问题 I am creating an app that involves reading in data from a file. The file is relatively large (1.8 MB) and is being read from an async thread in onCreate. The very first time the app is started up, it loads just fine. However, if you click the back button and then load it again, it runs out of memory and crashes (throwing the OutOfMemory error). How do I get it to use the lowest amount of memory possible and/or free that memory when it is done? File Reading Code (executed in the doInBackground

Application class variables gets uninitialised in android

这一生的挚爱 提交于 2019-12-24 05:47:08
问题 I have created an android app in which i'm using an application class to store and access the global variables. But i came across a strange behavior that all the variables in my application class gets uninitialized in the following scenarios, if my app is idle for sometime(say 10 minutes or so). if my app goes to background (if a browser gets opened above the app). I searched a lot in SO and web and doesn't found any suitable answer. AFAIK once application class is initialized it will be