2

I wants to know the available heap size at runtime because when I was loading images,it is running out of memory error.

For checking my memory leaks I want to know the heapsize at some particular breakpoints.

Can anyone tell me how to get the available heap size left for my application programatically.

Thanks

user1891910
  • 919
  • 3
  • 18
  • 45
  • possible duplicate http://stackoverflow.com/questions/2630158/detect-application-heap-size-in-android – Kolchuga Jan 29 '14 at 07:36

2 Answers2

0

Try this function

Debug.getNativeHeapSize() 

the debug class hve number of methods for tracking allocations

Shinto Joseph
  • 1,081
  • 8
  • 8
0

Use ActivityManager.getMemoryClass() or getLargeMemoryClass (). This returns approximate amount of memory you are allowed to use, in megabytes.

Use getApplication().getSystemService(ACTIVITY_SERVICE) to get the activity manager.

Audrius Meškauskas
  • 20,936
  • 12
  • 75
  • 93
  • I wants to know available space left in my heap everytime when I call webservices,so that I can understand whether my ImageLoader class is occupying my heap or not – user1891910 Jan 29 '14 at 07:51