title: Android out of memory when assigning variables
body: <p>So I get this:</p>
  
  <pre><code>'01-01 20:37:34.859: E/dalvikvm-heap(19921): Out of memory on a 6471856-byte allocation.'
  </code></pre>
  
  <p>When trying to assign a bunch of variables to memory.
  I'm assigning 24 variables like these:</p>
  
  <pre><code>mElements.add(new ShopElement(getResources(),R.drawable.shop_starter, b1X , b1Y,true,1,"red",true,5,checkLocked(0)));
  </code></pre>
  
  <p>And one of these:</p>
  
  <pre><code>bNumbers = new Bitmap[] {Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h0)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h1)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h2)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h3)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h4)
          ,65,65,true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h5)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h6)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h7)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h8)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.h9)
          , 65,65, true),
          Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.time)
                  , 50,50, true)};
  </code></pre>
  
  <p>But before I can get through #16 of the 24 elements I'm created, it crashes on certain phones.</p>
  
  <p>I have a <strong>Galaxy S2</strong> and it runs fine, but on the <strong>S3</strong> and other phones it crashes.</p>
  
  <p>I will be happy to provide more information upon request.</p>
  
  <p>I've searched this error before, tried to apply solutions,  and looked through the "Displaying Bitmaps Efficiently" thing, but nothing seems to help.</p>
  
  <p>What spins my head is that it works on the S2, but not the S3. Shouldn't the S3 exceed the S2 in every way?</p>
  
  <p>I am using a global BitmapFactory.Options to draw all my bitmaps I set the options as follows:</p>
  
  <pre><code>Global.opts = new BitmapFactory.Options();
      Global.opts.inDither=false;                     
      Global.opts.inPurgeable=true;                  
      Global.opts.inInputShareable=true;              
      Global.opts.inTempStorage=new byte[16 * 1024]; 
  </code></pre>