Wednesday, 12 August 2015

Solution For Out Of Memory Error

Out of memory error is most common error when you are developing an android application which deals with multiple images, large bitmaps or some kind of Animation.

This error comes only when image allocation crosses the limit of heap size.

Now Here I provide you a solution to remove Out of Memory Error.

Solution is: You have to use MAT Tool (Memory Analyzer Tool). Its a one kind of plugin which is used in Eclipse.

Step 1: Download MAT Tool for eclipse using following link.
http://www.eclipse.org/mat/downloads.php

Step 2: Start eclipse and run your application.

Step 3: Click on DDMS --> click on Dump HPROF button --> Save hprof file in your hard drive

Step 4: Run MemoryAnalyzer.exe file from downloaded MAT Tool

Step 5: This MAT tool will not understand the hprof file generated by Eclipse so you have to convert it using the hprof-conv tool in the tools folder of android-sdk using the following command:

hprof-conv com.example.android.hcgallery.hprof mat.hprof

Step 6: Now this file is ready to use with MAT.

No comments:

Post a Comment