diff --git a/shell/android/AndroidManifest.xml b/shell/android/AndroidManifest.xml index a05dd9e19..5d6f3f570 100644 --- a/shell/android/AndroidManifest.xml +++ b/shell/android/AndroidManifest.xml @@ -15,6 +15,7 @@ diff --git a/shell/android/src/com/reicast/emulator/GL2JNIView.java b/shell/android/src/com/reicast/emulator/GL2JNIView.java index 1a2ccb107..9c2d792ee 100644 --- a/shell/android/src/com/reicast/emulator/GL2JNIView.java +++ b/shell/android/src/com/reicast/emulator/GL2JNIView.java @@ -209,6 +209,9 @@ class GL2JNIView extends GLSurfaceView this.editVjoyMode = editVjoyMode; setKeepScreenOn(true); vib=(Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + + Runtime.getRuntime().freeMemory(); + System.gc(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true); diff --git a/shell/android/src/com/reicast/emulator/InputModFragment.java b/shell/android/src/com/reicast/emulator/InputModFragment.java index 952d34fe9..18e7d739d 100644 --- a/shell/android/src/com/reicast/emulator/InputModFragment.java +++ b/shell/android/src/com/reicast/emulator/InputModFragment.java @@ -56,6 +56,9 @@ public class InputModFragment extends Fragment { @Override public void onViewCreated(View view, Bundle savedInstanceState) { parentActivity = getActivity(); + + Runtime.getRuntime().freeMemory(); + System.gc(); mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity); @@ -348,6 +351,7 @@ public class InputModFragment extends Fragment { } private Drawable getButtonImage(int x, int y) { + System.gc(); try { InputStream bitmap = parentActivity.getAssets().open("buttons.png"); BitmapFactory.Options options = new BitmapFactory.Options(); @@ -355,6 +359,7 @@ public class InputModFragment extends Fragment { Bitmap image = BitmapFactory.decodeStream(bitmap, null, options); bitmap.close(); bitmap = null; + System.gc(); Matrix matrix = new Matrix(); matrix.postScale(32, 32); Bitmap resizedBitmap = Bitmap.createBitmap(image, x, y, 64 / sS,