Search code examples
clojuregraalvmgraalvm-native-image

How can I reduce the filesize of a graal native image?


I have this project: https://github.com/crinklywrappr/repoman

It's very short (~150loc). When I run lein native-image it produces a massive 4gb3gb binary (at least on windows).

I believe there are a couple of reasons for the size:

  1. --allow-incomplete-classpath is required due to an error compiling clj-http-lite. (this may have fixed it) Including this commit reduced the size by 1gb.
  2. JCA security services adds some size, and the devs are looking into ways of reducing that.

I've never made a native image with graal before today. What steps can be taken to reduce the binary size of a graal native image?


Solution

  • It turns out that the graal was reporting memory consumption during compilation, and I was mis-attributing that to filesize.