title: Why app getting crash when It started Waiting for a blocking GC Alloc, When I start my Service?
body: <p>I'm Starting a <code>Service</code>(location service) at the beginning of app launch. But after staying on the App (approx. 5 to 10 minutes) I'm getting <em><code>Waiting for a blocking GC Alloc</code></em> error continuously and my app get stuck for a while then suddenly It crashes. 
  Also, When I run the app without Service it works smoothly.</p>
  
  <p>I've been searching for many days but nothing solved my problem. I checked many related Q/A over Stack overflow but there are not seems to be any proper or valuable answers.</p>
  
  <p>I also tried by added <code>android:largeHeap="true"</code> in manifests and <code>multiDexEnabled true</code> but these didn't help even.</p>
  
  <p><strong>Here's my Service class</strong></p>
  
  <pre><code>public class LocationService extends IntentService {
  
      private Context context;
      private FusedLocationProviderClient fusedLocationClient;
      private LocationRequest locationRequest;
      Task&lt;LocationSettingsResponse&gt; task;
  
      public static String NOTIFICATION_CHANNEL_ID = "com.example.simpleapp",
              CHANNEL_NAME = "My Background Service";
  
      public LocationService() {
          super("LocationService");
      }
  @Override
      public void onCreate() {
          super.onCreate();
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O)
              startMyOwnForeground();
          else startForeground(8, new Notification());
  
          createLocationRequest();
  
  
          context = this;
          fusedLocationClient = LocationServices.getFusedLocationProviderClient(context);
  
  
          LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest);
          SettingsClient client = LocationServices.getSettingsClient(context);
          task = client.checkLocationSettings(builder.build());
  
      }
  
  
      @Override
      public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
  
          try {
              fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());
          } catch (SecurityException ignore) {
              Log.e("AppLocationService", "SecurityException - " + ignore.toString(), ignore);
          }
  
  
          return Service.START_STICKY;
      }
  
  
      private final LocationCallback locationCallback = new LocationCallback() {
  
          @Override
          public void onLocationResult(LocationResult locationResult) {
              List&lt;Location&gt; locationList = locationResult.getLocations();
              if (locationList.size() != 0) {
  
                  Location location = locationList.get(0);
  
                  double latitude = location.getLatitude();
                  double longitude = location.getLongitude();
  
                  Intent intent = new Intent("location_update");
                  intent.putExtra("latitude", lat);
                  intent.putExtra("longitude", lng);
                  sendBroadcast(intent);
              }
          }
      };
  
   @Nullable
      @Override
      public IBinder onBind(Intent intent) {
          return null;
      }
  
      @Override
      protected void onHandleIntent(@Nullable Intent intent) {
  
  
      }
  
  
      protected void createLocationRequest() {
          locationRequest = LocationRequest.create();
          locationRequest.setInterval(2000);
          locationRequest.setFastestInterval(2000);
          locationRequest.setPriority(CommonObjects.LOCATION_PRIORITY);
      }
  }
  </code></pre>
  
  <p><strong>My Logcat</strong></p>
  
  <p><a href="https://i.stack.imgur.com/FTEc4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FTEc4.png" alt="Logcat Image"></a></p>