Android Werfen OutOfMemoryError "Fehler beim zuordnen einer 164 byte-Zuordnung mit 44 freien bytes und 44B bis OOM" (rekursiver Fall)

Diese app funktionierte gestern, aber beim starten heute morgen arbeiten, bekomme ich die folgende Fehlermeldung

Throwing OutOfMemoryError "Failed to allocate a 164 byte allocation with 44 free bytes and 44B until OOM" (recursive case)

Ich habe keine Ahnung, was Los ist, oder warum es aus dem Speicher. Ist das nur der emulator nicht perfekt arbeitet? Oder hat das etwas zu tun mit meiner app?

Ich weiß nicht, wie viel Informationen, die Sie benötigen. Wenn Sie weitere Informationen benötigen, bitte sagen Sie mir so und ich stellen.

UPDATE:

Ich denke, das hat etwas zu tun mit der garbage collector? Siehe unten

Background sticky concurrent mark sweep GC freed 2839(223KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 1603KB/1603KB, paused 31.379ms total 44.794ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 529(29KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 1574KB/2MB, paused 52.919ms total 60.062ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 5551(277KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 4MB/7MB, paused 15.550ms total 85.518ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 20777(1035KB) AllocSpace objects, 0(0B) LOS objects, 36% free, 7MB/11MB, paused 12.467ms total 61.496ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 46653(2MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 12MB/16MB, paused 1.335ms total 138.439ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 27622(1368KB) AllocSpace objects, 0(0B) LOS objects, 20% free, 15MB/19MB, paused 1.459ms total 182.567ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 45635(2MB) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 1.365ms total 157.690ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 22802(1159KB) AllocSpace objects, 0(0B) LOS objects, 16% free, 20MB/24MB, paused 1.211ms total 180.755ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 14475(641KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 23MB/24MB, paused 1.106ms total 122.625ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 27477(1338KB) AllocSpace objects, 0(0B) LOS objects, 14% free, 23MB/27MB, paused 1.511ms total 147.653ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 37938(1865KB) AllocSpace objects, 0(0B) LOS objects, 13% free, 25MB/29MB, paused 1.253ms total 178.420ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 23214(1147KB) AllocSpace objects, 0(0B) LOS objects, 12% free, 28MB/32MB, paused 3.789ms total 190.825ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 36253(1773KB) AllocSpace objects, 0(0B) LOS objects, 11% free, 31MB/35MB, paused 1.085ms total 227.583ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 13949(616KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 34MB/35MB, paused 665us total 175.362ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 40440(2000KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 2.158ms total 311.515ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 13956(617KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 36MB/37MB, paused 42.198ms total 81.851ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 33376(1624KB) AllocSpace objects, 0(0B) LOS objects, 9% free, 36MB/40MB, paused 1.211ms total 322.374ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 4052(174KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 40MB/40MB, paused 1.245ms total 105.928ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 38452(1891KB) AllocSpace objects, 0(0B) LOS objects, 9% free, 39MB/43MB, paused 1.212ms total 282.053ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 15083(667KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 42MB/43MB, paused 1.006ms total 134.368ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 33122(1609KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 42MB/46MB, paused 1.759ms total 685.984ms
2431-2443/com.example.christian.welldanaapp W/art Suspending all threads took: 21.776ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 2898(122KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 46MB/46MB, paused 23.019ms total 71.640ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 29828(1485KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 45MB/49MB, paused 1.250ms total 194.222ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 37388(1848KB) AllocSpace objects, 0(0B) LOS objects, 7% free, 48MB/52MB, paused 1.243ms total 332.837ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 31151(1528KB) AllocSpace objects, 0(0B) LOS objects, 7% free, 51MB/55MB, paused 1.446ms total 336.916ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 12755(563KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 54MB/55MB, paused 14.512ms total 48.881ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 40981(2014KB) AllocSpace objects, 0(0B) LOS objects, 6% free, 53MB/57MB, paused 1.288ms total 402.576ms
2431-2443/com.example.christian.welldanaapp W/art Suspending all threads took: 18.769ms
2431-2443/com.example.christian.welldanaapp I/art Background partial concurrent mark sweep GC freed 32370(1572KB) AllocSpace objects, 0(0B) LOS objects, 6% free, 56MB/60MB, paused 20.234ms total 387.007ms
2431-2443/com.example.christian.welldanaapp W/art Suspending all threads took: 10.568ms
2431-2443/com.example.christian.welldanaapp I/art Background sticky concurrent mark sweep GC freed 12559(558KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 59MB/60MB, paused 11.757ms total 42.520ms
2431-2443/com.example.christian.welldanaapp I/art Clamp target GC heap from 64MB to 64MB

Tatsächlichen roten text:

07-22 06:39:06.976    2431-2431/com.example.christian.welldanaapp E/AndroidRuntime Error reporting crash
java.lang.OutOfMemoryError: Failed to allocate a 458 byte allocation with 1613776 free bytes and 1575KB until OOM; failed due to fragmentation (required continguous free 32768 bytes for a new buffer where largest contiguous free 4096 bytes)
        at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
        at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:146)
        at java.lang.StringBuilder.append(StringBuilder.java:216)
        at java.lang.Throwable.toString(Throwable.java:360)
        at java.lang.Throwable.printStackTrace(Throwable.java:315)
        at java.lang.Throwable.printStackTrace(Throwable.java:300)
        at android.util.Log.getStackTraceString(Log.java:335)
        at com.android.internal.os.RuntimeInit.Clog_e(RuntimeInit.java:59)
        at com.android.internal.os.RuntimeInit.access$200(RuntimeInit.java:43)
        at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:85)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

EDIT: JAVA CODE

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    ChangeLanguage("dk");
    SetListeners();
}

//Changes the language depending on the button pressed
private void ChangeLanguage(String language){
    Locale locale = new Locale(language);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getResources().updateConfiguration(config,getResources().getDisplayMetrics());
    setContentView(R.layout.activity_main);
    RestartActivity();
}

//Restarts the activity after changing the languagse
private void RestartActivity(){
    Intent intent = getIntent();
    finish();
    startActivity(intent);
}

InformationsquelleAutor der Frage Detilium | 2015-07-22

Schreibe einen Kommentar