Skip to content
This repository was archived by the owner on Apr 25, 2021. It is now read-only.

Don't pass MaxPermSize to Java 8+ #66

Merged
merged 2 commits into from
Apr 29, 2014

Conversation

rtyley
Copy link
Contributor

@rtyley rtyley commented Apr 22, 2014

This change stops this annoying message being written to stderr (which can cause IntelliJ to freak):

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

See also:
https://bugs.openjdk.java.net/browse/JDK-6964458
sbt/sbt-native-packager#203
https://github.com/typesafehub/activator/issues/422

Re-producing the warning message:

$ sudo update-java-alternatives -s java-8-oracle ; sbt -v about
# Executing command line:
java
-Xms1024m
-Xmx1024m
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m
-jar
/usr/share/sbt-launcher-packaging/bin/sbt-launch.jar
about

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

rtyley added 2 commits April 23, 2014 00:02
...don't bother if won't use them due to them already being defined.
This change stops this annoying message being written to stderr (which can
cause IntelliJ to freak):

```
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
```

See also:

https://bugs.openjdk.java.net/browse/JDK-6964458
sbt/sbt-native-packager#203
https://github.com/typesafehub/activator/issues/422
@rtyley
Copy link
Contributor Author

rtyley commented Apr 23, 2014

cc @jsuereth

(( $codecache < 512 )) || codecache=512

local common_opts="-Xms${mem}m -Xmx${mem}m -XX:ReservedCodeCacheSize=${codecache}m"
if [[ "$java_version" < "1.8" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jsuereth
Copy link
Member

Looks great, thanks for the fixes!

jsuereth added a commit that referenced this pull request Apr 29, 2014
@jsuereth jsuereth merged commit 09b4ae7 into sbt:master Apr 29, 2014
@rtyley
Copy link
Contributor Author

rtyley commented Apr 29, 2014

Thanks!

@jroper
Copy link
Member

jroper commented Oct 1, 2014

Just got a notification that pointed to this... could I recommend rather than not configuring the size at all, that you configure it via MaxMetaspaceSize? See:

https://github.com/typesafehub/activator/pull/506

If you don't configure it, then in Java 8, classloader leaks end up leaking system memory, so over time sbt will cause the system to run out of memory, causing swapping and potentially an eventual system crash (or the Linux OOM killer will start choosing random kittens to kill). Given that sbt's test and run tasks very often run in JVM, and that these very often have classloader leaks, this is something that sbt should take particular care to ensure doesn't happen.

rtyley added a commit to rtyley/sbt-launcher-package that referenced this pull request Oct 1, 2014
@jroper points out that class metadata has to go somewhere, and it's new
name is 'Metaspace' - not 'PermGen':

sbt#66 (comment)

http://java.dzone.com/articles/java-8-permgen-metaspace
rtyley added a commit to rtyley/sbt-launcher-package that referenced this pull request Oct 1, 2014
@jroper points out that class metadata has to go somewhere, and it's new
name is 'Metaspace' - not 'PermGen':

sbt#66 (comment)

http://java.dzone.com/articles/java-8-permgen-metaspace
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants