Skip to content

.sbtopts memory options not working on Windows #7387

@ptrdom

Description

@ptrdom

steps

Tested on Windows 11 and sbt 1.9.6 by:

  • Running sbt from terminal on a project.
  • Running IntelliJ project with BSP support using sbt as build server.

Run sbt with following .sbtopts file present in working directory:

-J-XX:MaxMetaspaceSize=4G
-J-XX:MaxInlineLevel=20
-J-Xss2m
-J-Xms512M
-J-Xmx6G
-J-XX:ReservedCodeCacheSize=256M

These options were taken from https://github.com/disneystreaming/smithy4s/blob/series/0.18/.sbtopts.

problem

Memory options do not get assigned to the spawned sbt process. Default options get assigned instead.

expectation

Memory options should get assigned to the spawned sbt process.

notes

I think the issue is looping of _SBT_OPTS done in this function - https://github.com/sbt/sbt/blob/1.10.x/launcher-package/src/universal/bin/sbt.bat#L825-L855. The for loop of _SBT_OPTS set to -XX:MaxMetaspaceSize=4G -XX:MaxInlineLevel=20 -Xss2m -Xms512M -Xmx6G -XX:ReservedCodeCacheSize=256M only enters loop with -XX:MaxMetaspaceSize=4G and then exits. Placing a memory argument as a first argument in .sbtopts instead can be used as a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions