-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Restarter creates memory leak in tests #37373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just curious, why would you use devtools in tests? |
@chris-melman if you declare DevTools in the |
If DevTools is on the test runtime classpath, the problem occurs even when the |
A couple of options:
|
developmentOnly is not a gradle default, however I see that is documented way to add the dependency to gradle https://docs.spring.io/spring-boot/docs/2.7.15/reference/htmlsingle/#using.devtools However this doesn't really work well with eclipse plugin of gradle. |
We're going to try option 2 and not add the contexts if the restarter is disabled. |
We run into memory problems on our buildstreet for automated tests.
We are using an abstract base class (removed non spring functionality)
After some investigation we found that the org.springframework.boot.devtools.restart.Restarter is adding context to its rootContexts, however they never seems to be cleaned


spring-boot/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java
Line 122 in c4368bc
Setting spring.test.context.cache.maxSize didn't help.
The current workaround is that we call the
Restarter.clearInstance()
after each test. However this is more a workaround. I would expect that the@SpringBootTest
would clean this after the test has been run.The text was updated successfully, but these errors were encountered: