[KT-42275] Eliminate recursive GC calls (#4412)
This commit is contained in:
@@ -2115,7 +2115,7 @@ void updateHeapRefIfNull(ObjHeader** location, const ObjHeader* object) {
|
||||
}
|
||||
|
||||
inline void checkIfGcNeeded(MemoryState* state) {
|
||||
if (state != nullptr && state->allocSinceLastGc > state->allocSinceLastGcThreshold) {
|
||||
if (state != nullptr && state->allocSinceLastGc > state->allocSinceLastGcThreshold && state->gcSuspendCount == 0) {
|
||||
// To avoid GC trashing check that at least 10ms passed since last GC.
|
||||
if (konan::getTimeMicros() - state->lastGcTimestamp > 10 * 1000) {
|
||||
GC_LOG("Calling GC from checkIfGcNeeded: %d\n", state->toRelease->size())
|
||||
@@ -2125,7 +2125,8 @@ inline void checkIfGcNeeded(MemoryState* state) {
|
||||
}
|
||||
|
||||
inline void checkIfForceCyclicGcNeeded(MemoryState* state) {
|
||||
if (state != nullptr && state->toFree != nullptr && state->toFree->size() > kMaxToFreeSizeThreshold) {
|
||||
if (state != nullptr && state->toFree != nullptr && state->toFree->size() > kMaxToFreeSizeThreshold
|
||||
&& state->gcSuspendCount == 0) {
|
||||
// To avoid GC trashing check that at least 10ms passed since last GC.
|
||||
if (konan::getTimeMicros() - state->lastGcTimestamp > 10 * 1000) {
|
||||
GC_LOG("Calling GC from checkIfForceCyclicGcNeeded: %d\n", state->toFree->size())
|
||||
|
||||
Reference in New Issue
Block a user