Size difference of Java.base image between OSX and Linux

Waldek Kozaczuk jwkozaczuk at gmail.com
Fri Oct 28 17:32:48 UTC 2016


I used jlink to create minimal custom JRE image on OSX and Linux and I noticed there is a significant difference in size. The Mac version takes 21M where the Linux one takes 30M which means Linux version is 50% bigger than Mac.

Is it as you would have expected? Why is size difference so big?

I noticed that lib/modules is similar in size (1M difference) but the biggest difference is between ./lib/server/libjvm.dylib (12 M) and ./lib/amd64/server/libjvm.so (21 M). So the linux version of the shared library object is almost twice as big on linux (both 64 bit).

Here is the command I used to create the image:
jdk-9/bin/jlink --module-path jdk-9/jmods --add-modules java.base --output image_target --strip-debug --compress=2

Here is a detailed listing of files on Mac:
68K	./bin/java 68K	./bin/keytool 8.0K	./conf/net.properties 4.0K	./conf/security/java.policy 40K	./conf/security/java.security 4.0K	./conf/security/policy/limited/default_local.policy 4.0K	./conf/security/policy/limited/default_US_export.policy 4.0K	./conf/security/policy/limited/exempt_local.policy 4.0K	./conf/security/policy/README.txt 4.0K	./conf/security/policy/unlimited/default_local.policy 4.0K	./conf/security/policy/unlimited/default_US_export.policy 20K	./include/classfile_constants.h 4.0K	./include/darwin/jni_md.h 76K	./include/jni.h 80K	./include/jvmti.h 4.0K	./include/jvmticmlr.h 68K	./lib/jli/libjli.dylib 16K	./lib/jspawnhelper 4.0K	./lib/jvm.cfg 204K	./lib/libjava.dylib 32K	./lib/libjimage.dylib 12K	./lib/libjsig.dylib 92K	./lib/libnet.dylib 68K	./lib/libnio.dylib 44K	./lib/libosxsecurity.dylib 48K	./lib/libverify.dylib 32K	./lib/libzip.dylib 7.2M	./lib/modules 4.0K	./lib/security/blacklist 4.0K	./lib/security/blacklisted.certs 112K	./lib/security/cacerts 8.0K	./lib/security/default.policy 0B	./lib/security/trusted.libraries 12K	./lib/server/libjsig.dylib 12M	./lib/server/libjvm.dylib 4.0K	./lib/server/Xusage.txt 104K	./lib/tzdb.dat 4.0K	./release

Here is a detailed listing of files on Linux:

4.0K	./lib/security/blacklisted.certs
8.0K	./lib/security/default.policy
4.0K	./lib/security/blacklist
0	./lib/security/trusted.libraries
104K	./lib/tzdb.dat
12K	./lib/jexec
4.0K	./lib/amd64/jvm.cfg
108K	./lib/amd64/libnet.so
72K	./lib/amd64/jli/libjli.so
132K	./lib/amd64/libjimage.so
220K	./lib/amd64/libjava.so
36K	./lib/amd64/libzip.so
21M	./lib/amd64/server/libjvm.so
4.0K	./lib/amd64/server/Xusage.txt
12K	./lib/amd64/server/libjsig.so
88K	./lib/amd64/libnio.so
12K	./lib/amd64/libjsig.so
64K	./lib/amd64/libverify.so
8.2M	./lib/modules
4.0K	./release
4.0K	./include/jvmticmlr.h
4.0K	./include/linux/jni_md.h
20K	./include/classfile_constants.h
80K	./include/jvmti.h
76K	./include/jni.h
4.0K	./conf/security/policy/limited/default_local.policy
4.0K	./conf/security/policy/limited/default_US_export.policy
4.0K	./conf/security/policy/limited/exempt_local.policy
4.0K	./conf/security/policy/README.txt
4.0K	./conf/security/policy/unlimited/default_local.policy
4.0K	./conf/security/policy/unlimited/default_US_export.policy
40K	./conf/security/java.security
4.0K	./conf/security/java.policy
8.0K	./conf/net.properties
12K	./bin/java
12K	./bin/keytool

Regards,
Waldek

Sent from my iPhone


More information about the jigsaw-dev mailing list