Skip to content

Commit 91254ff

Browse files
committed
Merge pull request oracle#139 in G/truffle from ~JAROSLAV.TULACH_ORACLE.COM/truffle:OneGarbageCheckPerSecond to master
* commit 'fe360adade17a5dcba14dc56b99decb7039df229': Limit the check for GCed Source objects to once per second to impact benchmarks that do many Source creations less
2 parents 3ab5316 + fe360ad commit 91254ff

File tree

1 file changed

+7
-1
lines changed
  • truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source

1 file changed

+7
-1
lines changed

truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/SourceImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ protected SourceImpl clone() throws CloneNotSupportedException {
4949
return clone;
5050
}
5151

52+
private static long nextCheck;
53+
5254
static synchronized void registerSource(SourceImpl source) {
53-
findSource(null);
55+
long now = System.currentTimeMillis();
56+
if (nextCheck < now) {
57+
findSource(null);
58+
nextCheck = now + 1000;
59+
}
5460
SOURCES = new Ref(source, SOURCES);
5561
}
5662

0 commit comments

Comments
 (0)