adb.exe spawning many process instances - android

I'm new to developing for Android and have been tasked with helping the development of some React Native based Android application. I have a working setup in which an emulated Android device can run this application. However, when starting the emulator, the process adb.exe repeatedly gets spawned in the background at a rate of about 1 process per second. These processes seemingly take no/very little memory (144K according to the Task Manager), but over time, this still adds up to a massive list of processes (nearing 3000 at the time of writing) taking up quite a bit of memory (which is already scarce thanks to a fairly heavy development toolchain).
Closing the emulator does not automatically terminate these processes. The only way I have found so far that works is by using taskkill /IM /F.
Is this expected behaviour? If not, how could I begin with tracking down the reasons for behaviour.

If that happens again try to find in task manager, there will be numerous adb.exe processes popping-up most of them with same memory usage.Lookout for a process which uses different amount of memory once you identify it dont make any changes to that one instead stop processes that display same memory usage if you even kill one of those whole stack of them will come down to one adb.exe process. i've faced a similar issue and doing this has solved the problem. generally, it happens when you start to run emulator thats when you need to see the taskmanager.

Related

AOSP emulator memory filling up very quickly

I'm currently working with AOSP and building an app for the Android Automotive OS. I have compiled the same code (checked out from version control) on two different PCs (both running Ubuntu). On one of them (with an Intel CPU) the emulator starts up fine and the emulator is stable.
On the other PC (an AMD CPU) the emulator starts up, but will quickly crash with OutOfMemory errors. AOSP is quickly killing all processes, then its system processes and finally reboots due to 'System is deadlocked on memory'.
I found that the culprit is a system process. It hoards a lot of memory:
the android.hardware.automotive.vehicle process is hoarding memory. It keeps growing very quickly and finally the OS reboots.
When I use the meminfo tool to inspect memory usage of the process, I find the following:
The android.hardware.automotive.vehicle process is using over 2GB of RAM.
My questions thus are:
Do you what is happening?
How can I debug this system process?
Why is the system process behaving differently on one PC compared to another PC?
For those who ran into this issue:
After a lot of fiddling around, I found that adding custom vehicle properties to the VHAL definitions (think of the types.hal and DefaultConfig.h files) must be done very carefully. In my case, I added a vehicle property with VehiclePropertyChangeMode set to CONTINUOUS, but did not add a minimum and maximum sample rate. This caused the android.hardware.automotive.vehicle service to keep requesting more and more memory for some reason and finally the emulator would crash.
If you want to prevent this from happening, make sure to add a minSampleRate and maxSampleRate in your DefaultConfig.h file!

Android emulators bugs

lately I am facing some troubles with my android emulators, some of them start but never work, others start and after several minutes my pc crashes and others do not start at all.
Any solutions? Like turn it off and on? or just restart your computer when something bad happen?
I will appreciate any help!
If your RAM is below 8GB then you want to consider upgrading your
RAM.
Run one emulator at a time. Sometimes you might get frustrated and
therefore starting up two at a time, this will slow down your system
and the emulator performance as well. Solution for this is run a
system task manager check to see all running process then terminate
the unnecessary processes running.
Finally, if the above don't help; I will suggest you download
Bluestack Android Emulator as that is so much kin to work with and
reliable.
Download Bluestack here

My emulator is taking up too much memory

As per the title, my Android Studio seems to be using too much memory, even at idle. For my friend, he is able to run his emulator at only ~300MB of RAM usage, according to Windows' Task Manager. I've tried duplicating his emulator settings, even with his emulator set to 1.5GB of RAM, it is only using about 300MB. Mine goes up to 1.5GB, sometimes even 2GB, just by getting it started, I'm not even running any apps on it.
Is this even possible? Running it at only ~300MB, because on mine, the lowest I can go is 1024MB, setting anything lower results in no change in Task Manager.
Maybe in the installation process you installed more things than him. That's why it's eating a lot more memory

Android Emulator first startup time

We have latest android SDK setup with eclipse. We have android 4.x images (with and without google apis). When a new such AVD is created, the first run takes too long and some times it just keeps booting.
Examining logcat there are 3 things that take a lot of time.
DexOpt
resource loading
Collecting certs
I guess 1 and 3 are reasonable additions to startup time as one-time processes.
However, I don't understand why the startup takes arbitrary long time and sometimes just keeps booting.
As far as I know the AVD uses only one core of your computer to simulate "real device" data processing, however you are not bound to use the regular AVD as you can use genymotion emulator - it's faster and also has a plugin for eclipse.
you can also take a look here,here and here for further information

Reasons why my Android App would crash on my phone consistently, but not on my emulator

I have an app that uses quite a few graphics in it.
When I open and close my app repeatedly on my emulator (1.5 - 2.2) it runs fine and by checking the heap I can see everything is being cleaned and gc'd properly.
However, when I run my app on an HTC Aria phone (2.1) the app crashes every time I try to re-open it. When I look at the heap I can see that objects are NOT being cleaned up like they are in the emulator.
Does anyone know why this behavior could be happening? I did try it on another HTC Aria (a friends) and it crashed the same way as on my phone so I think it's not just isolated to my particular phone.
Any thoughts or ideas would be really appreciated on why things are cleaning up properly on the emulator, but not on my phone. One thing to note, is that I DID have it working and gc'ing fine on my phone a few days ago and I didn't change much and now it's not working on my phone so it's a bit of a mystery to me.
Thanks!
Note:
The crash is caused by an OutOfMemory Exception. I'm pre-loading a handful of graphics, and there's not enough memory for two instances of the application to be running at the same time so it's crashing because the 1st instance of the application was not cleaned up properly.
You have several emulators, all running just this app, closing it and start it again.
Your Android device has several processes running the same time, like background sync, Facebook notification, Twitter notification, Calendar sync, Contacts sync and the like.
One way to look at this is to try to mimic your Android device state on your different emulators, and see if you can get the same error on the emulators. Use some apps that sync in the background and others who use a lot of memory. Then you have a testing environment that mimics the real world, and you can change your app up to a state where it doesn't crash. Maybe downsize the images as much as you can to ease memory usage.
Remember, you can never force the Garbace Collector to start. You can only tell the system that it is possible to collect this garbage.

Categories

Resources