Skip to content

Commit e2ab628

Browse files
committed
Minimum RSS threshold to do background GC
1 parent b9c31f5 commit e2ab628

File tree

1 file changed

+9
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+9
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiContext.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,11 @@ private BackgroundGCTask(PythonContext context) {
635635
*/
636636
static final double GC_RSS_THRESHOLD = Integer.getInteger("python.RSSThreshold", 30) / 100.0;
637637

638+
/**
639+
* RSS minimum memory (in megabytes) start calling System.gc(). Default is 4GB.
640+
*/
641+
static final double GC_RSS_MINIMUM = Integer.getInteger("python.RSSMinimumMB", 4096);
642+
638643
Long getCurrentRSS() {
639644
if (nativeSymbol == null) {
640645
nativeSymbol = CApiContext.getNativeSymbol(null, NativeCAPISymbol.FUN_GET_CURRENT_RSS);
@@ -680,6 +685,10 @@ private void perform() {
680685
return;
681686
}
682687

688+
if (rss < GC_RSS_MINIMUM) {
689+
return;
690+
}
691+
683692
// skip GC if no new native weakrefs have been created.
684693
int currentWeakrefCount = context.nativeContext.nativeLookup.size();
685694
if (currentWeakrefCount < this.previousWeakrefCount || this.previousWeakrefCount == -1) {

0 commit comments

Comments
 (0)