How will you find if your application is running on low memory, or out of memory?

Asked 22-Jan-2018
Viewed 355 times

1

How will you find if your application is running on low memory, or out of memory?


1 Answer


0

To check for the memory simple run this periodically

Runtime.getRuntime().maxMemory();

Runtime.getRuntime().totalMemory();

Runtime.getRuntime().freeMemory();

it will show all the details such as maximum memory your app is taking or total memory your app acquires. 

you can also override the following method to get the memory information - 

@Override

    public void onLowMemory() {

        super.onLowMemory();

        Log.w(TAG, "onLowMemory() -> clearImageCacheFu!!!");

        clearImageCacheFu();

        dispatchGoogleTracker();

        stopGoogleTracker();

    }