mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
C/Wasm: fix OOME from compiled application
This commit is contained in:
parent
236c6191c2
commit
1ac0f7156c
|
@ -167,8 +167,13 @@ public final class GC {
|
||||||
private static void collectGarbageImpl(int size) {
|
private static void collectGarbageImpl(int size) {
|
||||||
doCollectGarbage();
|
doCollectGarbage();
|
||||||
|
|
||||||
|
long minRequestedSize = 0;
|
||||||
|
if (!hasAvailableChunk(size)) {
|
||||||
|
minRequestedSize = computeMinRequestedSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isFullGC) {
|
if (!isFullGC) {
|
||||||
if (++youngGCCount >= 8 && isAboutToExpand(size)) {
|
if (++youngGCCount >= 8 && isAboutToExpand(minRequestedSize)) {
|
||||||
triggerFullGC();
|
triggerFullGC();
|
||||||
doCollectGarbage();
|
doCollectGarbage();
|
||||||
youngGCCount = 0;
|
youngGCCount = 0;
|
||||||
|
@ -178,10 +183,6 @@ public final class GC {
|
||||||
}
|
}
|
||||||
isFullGC = false;
|
isFullGC = false;
|
||||||
|
|
||||||
long minRequestedSize = 0;
|
|
||||||
if (!hasAvailableChunk(size)) {
|
|
||||||
minRequestedSize = computeMinRequestedSize(size);
|
|
||||||
}
|
|
||||||
resizeHeapIfNecessary(minRequestedSize);
|
resizeHeapIfNecessary(minRequestedSize);
|
||||||
currentChunk = currentChunkPointer.value;
|
currentChunk = currentChunkPointer.value;
|
||||||
currentChunkLimit = currentChunk.toAddress().add(currentChunk.size);
|
currentChunkLimit = currentChunk.toAddress().add(currentChunk.size);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user