A project with only the following two activities will throw an OutOfMemoryError. Why does this happen? Shouldn't the older activities on the stack be released when memory is nearing the limit of the heap?
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startActivity(new Intent(getApplicationContext(), MemoryActivity.class));
}
}
public class MemoryActivity extends Activity
{
int[] testMem = new int[750000 * 3];
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
}