title: Two questions about max heap sizes and available memory in android
body: <p>I see that the Heap Size is automatically increased as the app needs it, up to whatever the phone's Max Heap Size is.  I also see that the Max Heap Size is different depending on the device.</p>
  
  <p>So my first question is, what are the typical Max Heap Sizes on Android devices?  I have tested memory allocation on one phone that was able to use a heap over 40mb while another gave out OutOfMemory errors in the 20's mbs.  What are the lowest that are in common use and what are the highest that are on common devices?  Is there a standard or average?</p>
  
  <p>The second question, and more important one, is how to ensure you are able to use the resources available per device but avoid using too much?  I know there are methods such as onLowMemory() but those seem to be only for the entire system memory, not just the heap for your specific application.</p>
  
  <p>Is there a way to detect the max heap size for the device and also detect when the available heap memory is reaching a low point for your application?</p>
  
  <p>For example, if the device only allowed a max heap of 24mb and the app was nearing that limit in allocation, then it could detect and scale back.  However, if the device could comfortably handle more, it would be able to take advantage of what is available.</p>
  
  <p>Thanks</p>