mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
C/Wasm: fix issue in GC
This commit is contained in:
parent
15466bad93
commit
ce5e3bfeb7
|
@ -115,12 +115,21 @@ public final class GC {
|
|||
return;
|
||||
}
|
||||
collectGarbageImpl(size);
|
||||
if (currentChunk.size != size && currentChunk.size <= size + MIN_CHUNK_SIZE && !getNextChunkIfPossible(size)) {
|
||||
ExceptionHandling.printStack();
|
||||
outOfMemory();
|
||||
if (!hasAvailableMemory(size)) {
|
||||
collectGarbageFullImpl(size);
|
||||
if (!hasAvailableMemory(size)) {
|
||||
ExceptionHandling.printStack();
|
||||
outOfMemory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasAvailableMemory(int size) {
|
||||
return currentChunk.size == size
|
||||
|| currentChunk.size > size + MIN_CHUNK_SIZE
|
||||
|| getNextChunkIfPossible(size);
|
||||
}
|
||||
|
||||
private static boolean getNextChunkIfPossible(int size) {
|
||||
while (true) {
|
||||
if (currentChunk.toAddress().isLessThan(currentChunkLimit)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user