kelloggm / checkerframework-gradle-plugin

Gradle plugin to use the Checker Framework for Java
Apache License 2.0
66 stars 15 forks source link

Use larger default max heap size #136

Closed mernst closed 3 years ago

mernst commented 3 years ago

This is an attempt to use a larger default max heap size. If this is the wrong way to do it, feel free to change it. Perhaps this should also check whether the user's buildfile sets the max memory.

kelloggm commented 3 years ago

It's not clear to me why the plugin should be responsible for setting the max heap size. The java compiler already includes a flag to do so (the one you're using here), so why not let the user set an appropriate size themselves?

I think your concern is that the default heap size is small enough that the CF runs out of memory even on mid-size projects. I agree that this is a problem, but I don't think that it's a problem that this plugin should solve. Primarily, I'm concerned about this overwriting a different max heap size that the user attempted to set manually - depending on when the plugin is applied and when the user configures the Java compiler in their own build script, anything that the plugin does may happen either before or after the user has set their own configuration. For that reason, if we were to include this in the plugin, we'd definitely need to check first to make sure that there's no other -Xmx option, at the very least. But, as I said in the last paragraph, I don't really think this problem is the plugin's to solve (and I'm worried attempting to do so will only confuse users).

mernst commented 3 years ago

OK, that's fair. I was concerned that users might not know which property to set. A user doesn't realize that the plugin creates a new JVM to run the compiler, and thus that a user should set compile.options.forkOptions.jvmArgs rather than org.gradle.jvmargs. Perhaps that is worth documenting.