Fix minor bug in memory management
Properly handle the case when the program finishes with empty 'toFree' buffer but non-empty deallocation queue.
This commit is contained in:
committed by
SvyatoslavScherbina
parent
f4fef09447
commit
155b7b698e
@@ -2205,6 +2205,10 @@ task memory_weak1(type: RunKonanTest) {
|
|||||||
source = "runtime/memory/weak1.kt"
|
source = "runtime/memory/weak1.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task memory_only_gc(type: RunStandaloneKonanTest) {
|
||||||
|
source = "runtime/memory/only_gc.kt"
|
||||||
|
}
|
||||||
|
|
||||||
task mpp1(type: RunStandaloneKonanTest) {
|
task mpp1(type: RunStandaloneKonanTest) {
|
||||||
source = "codegen/mpp/mpp1.kt"
|
source = "codegen/mpp/mpp1.kt"
|
||||||
flags = ['-tr', '-Xmulti-platform']
|
flags = ['-tr', '-Xmulti-platform']
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
konan.internal.GC.collect()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1358,6 +1358,8 @@ void GarbageCollect() {
|
|||||||
|
|
||||||
state->gcInProgress = true;
|
state->gcInProgress = true;
|
||||||
|
|
||||||
|
processFinalizerQueue(state);
|
||||||
|
|
||||||
while (state->toFree->size() > 0) {
|
while (state->toFree->size() > 0) {
|
||||||
CollectCycles(state);
|
CollectCycles(state);
|
||||||
processFinalizerQueue(state);
|
processFinalizerQueue(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user