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

Asked 7 years ago
Viewed 424 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();

    }

answered 7 years ago by Prateek sharma

Your Answer