title: Exception: dalvikvm-heap(1099): Out of memory
body: <p>I have problem I do not understand. When I reach the following code snippet</p>
  
  <pre><code>public class MatchViewActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Log.d("OnCreate in MatchViewActivity","1");
          setContentView(R.layout.activity_match_view); &lt;--- Crash occurrs here
          Log.d("","2");
          Intent intent = getIntent();
  </code></pre>
  
  <p>I get the following error in the simulator, always:</p>
  
  <pre><code>10-07 18:41:39.012: E/dalvikvm-heap(1099): Out of memory on a 3686416-byte allocation.
  </code></pre>
  
  <p>Some lines further down in the logcat I can find:</p>
  
  <pre><code> 10-07 18:41:39.452: E/AndroidRuntime(1099): FATAL EXCEPTION: main
  10-07 18:41:39.452: E/AndroidRuntime(1099): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.matchView.MatchViewActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class &lt;unknown&gt;
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.os.Handler.dispatchMessage(Handler.java:99)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.os.Looper.loop(Looper.java:137)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at java.lang.reflect.Method.invokeNative(Native Method)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at java.lang.reflect.Method.invoke(Method.java:511)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at dalvik.system.NativeStart.main(Native Method)
  10-07 18:41:39.452: E/AndroidRuntime(1099): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class &lt;unknown&gt;
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.Activity.setContentView(Activity.java:1881)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at com.example.matchView.MatchViewActivity.onCreate(MatchViewActivity.java:25)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.Activity.performCreate(Activity.java:5104)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     ... 11 more
  10-07 18:41:39.452: E/AndroidRuntime(1099): Caused by: java.lang.reflect.InvocationTargetException
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at java.lang.reflect.Constructor.constructNative(Native Method)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     ... 23 more
  10-07 18:41:39.452: E/AndroidRuntime(1099): Caused by: java.lang.OutOfMemoryError
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.content.res.Resources.loadDrawable(Resources.java:1965)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.View.&lt;init&gt;(View.java:3330)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:431)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.widget.FrameLayout.&lt;init&gt;(FrameLayout.java:101)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     at android.widget.FrameLayout.&lt;init&gt;(FrameLayout.java:97)
  10-07 18:41:39.452: E/AndroidRuntime(1099):     ... 26 more
  10-07 18:46:39.632: I/Process(1099): Sending signal. PID: 1099 SIG: 9
  </code></pre>
  
  <p>I checked that "activity_match_view" does exist. What is happening here? </p>
  
  <p>The corresponding layout file:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/main_background" &gt;
  
      &lt;ListView
          android:id="@+id/matchView_ListView"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" 
          android:cacheColorHint="#00000000"&gt;
      &lt;/ListView&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>