Why is my gallery app (designed using Glide) taking nearly 500mb RAM

I made a gallery app which show offline stored images using GLIDE library in recyclerView but when i view the Profiler in android Studio it shows me that the app is taking nearly 500mb memory. Is this normal that my app is taking this much memory.

However my app is not crashing but it hang sometimes while showing images and also images are load all togethor (i can see the size of scrollbar getting smaller)

Also after asking User-permission images are not shown instantly. I have to start the app again to view these images. Those images should have been visible after accepting the permission.

This is the normal look of my app  Sometime when scrolling some white space also come between the images.

1This is the normal look of my app.

2Sometime when scrolling some white space also come between the images (shown in brown shaped oval).

for reducing the memory, I tried to decrease the height of the imageView (thinking that may be now glide had to load less pixels) but didn’t work at all. for user-permission i tried using Android Developers Guide but still no luck.

// this is my main activity     private static final int MY_PERMISSIONS_REQUEST = 100;     private Cursor mCursor=null;      @Override     protected void onCreate(Bundle savedInstanceState) {         // layout initialization code         mCursor = getImageCursor();         requestStoragePermission();          recyclerView = findViewById(R.id.imageRecyclerView);         mAdapter = new mayankImageAdapter(this,mCursor);        //..... (setting the recyclerView)         RecyclerView.LayoutManager mLayoutManager = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);         recyclerView.setLayoutManager(mLayoutManager);         recyclerView.setItemAnimator(new DefaultItemAnimator());         recyclerView.setAdapter(mAdapter);      }      private void requestStoragePermission() {         if (ContextCompat.checkSelfPermission(MainActivity.this,                 Manifest.permission.READ_EXTERNAL_STORAGE)                 != PackageManager.PERMISSION_GRANTED) {             ActivityCompat.requestPermissions(MainActivity.this,                     new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},                     MY_PERMISSIONS_REQUEST);         }     }      @Override     public void onRequestPermissionsResult(int requestCode,                                            String permissions[], int[] grantResults) {         switch (requestCode) {             case MY_PERMISSIONS_REQUEST: {                 // If request is cancelled, the result arrays are empty.                 if (grantResults.length > 0                         && grantResults[0] == PackageManager.PERMISSION_GRANTED) {                      // permission was granted, yay! Do the                     // file-related task you need to do.                  }                 else {                      // permission denied, boo! Disable the                     // functionality that depends on this permission.                 }                 return;             }         }     }       public Cursor getImageCursor(){         try{             Uri externalUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;             String[] projection = new String[]{MediaStore.Images.Media._ID, MediaStore.Images.Media.TITLE,                             MediaStore.Images.Media.SIZE, MediaStore.Images.Media.DATA};             String sortOrder = MediaStore.Images.Media.TITLE+" ASC";              Cursor imageCursor = getContentResolver().query(externalUri,                         projection,null,null,sortOrder);             return imageCursor;         }catch(Exception e){             return null;         }     }     @Override     protected void onDestroy() {         mCursor.close();         super.onDestroy();     } } 

mayankImageAdapter.java

\ onBindViewHolder method     @Override     public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int position) {         if(imageCursor!=null) {             imageCursor.moveToFirst();             imageCursor.moveToPosition(position);             int strIndex = imageCursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);              String str = imageCursor.getString(strIndex);             File myimageloc = new File(str);             GlideApp.with(callingActivity).load(myimageloc).into(myViewHolder.imgView);          }else{             return;         }     } 

acitivity_main.xml

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.RecyclerView android:layout_width="match_parent"     android:layout_height="match_parent"     android:scrollbars="vertical"     android:id="@+id/imageRecyclerView"     xmlns:android="http://schemas.android.com/apk/res/android" /> 

I want to know the reason why my app is taking so much memory and what are steps to decrease this memory and how can i show images just after asking permissions from the user.

Thanks