title: Android Studio memory usage Ubuntu 16
body: <p>I'm facing an issue when consecutively running my android test class on an emulated device. I notice that after each run my PC RAM usage steadily increases by about 1.1Gb. This happens until my RAM is full, and then I have to restart my Android Studio and Emulator to run the test class smoothly again.</p>
  
  <p>To investigate I looked at my system monitor. In it, my emulator and android studio maintain roughly constant RAM usage after each test class run.</p>
  
  <p><a href="https://i.stack.imgur.com/s2uuj.png" rel="nofollow noreferrer">android studio and emulator RAM usage</a></p>
  
  <p>However my total RAM usage steadily increases after each test class run 
  3.2 -> 4.3 -> 5.5 -> 6.7 Gb</p>
  
  <p>On my emulated device I see that my app's maximum memory usage has only been 30mb</p>
  
  <p>I have tried clearing memory after each run using <code>echo 3 &gt; /proc/sys/vm/drop_caches</code> and this did not affect RAM usage.</p>
  
  <p>I am running Android Studio 2.2.3 on Ubuntu 16.04. The emulated device I use is Android 7.0 API 24 running on Nexus 5, 1Gb RAM, started in terminal using AVD. The test class I'm running contains UI tests using Espresso.</p>
  
  <p>UPDATE: This happens even when running empty espresso tests on an activity with a blank screen (no views). <a href="https://github.com/LeroyChristopherDunn/Android-Studio-Memory-Issues-When-Running-UI-Tests" rel="nofollow noreferrer">Please find code here</a></p>