Java heap dump - why so much memory is taken by Gradle
Turns out the test has invoked a functionality that caused a lot of logs to be printed in a short interval. (SL4J) Once removed, the memory behaved O.K. Not sure about the reason, but that was the solution.