-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove no longer needed garbage collector meddling. #971
base: next
Are you sure you want to change the base?
Conversation
We now have far more memory than before and file sizes also increased. I’m not sure whether we could just delete the whole gc code, though, and trust the JVM.
We absolutely should, especially because that code is not guaranteed to actually trigger a GC. The only way to force the JVM to do a garbage collection is by exhausting all memory; when the |
@Bombe I now removed that code and also the aggressiveGC option that was only used there. Also Hyphanet no longer dies during startup when an ignored option is used during startup (but I’m not happy about the error reporting: do we have a way to report this very loudly?). |
@@ -14,8 +14,7 @@ public class MemoryChecker implements Runnable { | |||
private volatile boolean goon = false; | |||
private final Ticker ps; | |||
private int aggressiveGCModificator; | |||
private RunningAverage avgFreeMemory; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field aggressiveGCModificator
can be removed, it’s always -1
now.
avgFreeMemory.report(freeMemory); | ||
} | ||
} | ||
|
||
int sleeptime = aggressiveGCModificator; | ||
if(sleeptime <= 0) { // We are done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aggressiveGCModificator
going away means this also doesn’t need an if
anymore.
@@ -407,21 +407,7 @@ public void set(Integer val) throws InvalidConfigValueException { | |||
threadLimit = statsConfig.getInt("threadLimit"); | |||
|
|||
// Yes it could be in seconds insteed of multiples of 0.12, but we don't want people to play with it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment can also be removed. 🙂
} | ||
},false); | ||
aggressiveGCModificator = statsConfig.getInt("aggressiveGC"); | ||
statsConfig.registerIgnoredOption("aggressiveGC"); | ||
|
||
myMemoryChecker = new MemoryChecker(node.getTicker(), aggressiveGCModificator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aggressiveGCModificator
should also be removed from this class, including the comment above its declaration. 🙂
o = (IntOption) map.get(optionName); | ||
} | ||
return o.getValue(); | ||
// return fallback value for ignored options (null). This avoids breaking plugins which try to get ignored options. | ||
return o == null ? -1 : o.getValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace the ternaries with the more descriptive Map.getOrDefault
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this class still serve any purpose (aside from scheduling itself 😄) after removing pretty much all of its code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, that is an excellent observation! 😄 Kill it with 🔥! 🥳
We now have far more memory than before and file sizes also increased.
I’m not sure whether we could just delete the whole gc code, though, and trust the JVM.