I faced the same issue and spend a few hours attempting to understand the root cause. I have tried to change the memory limits as suggested above. Simply put, I have tried everything, but it didn't help me.
Then I got an idea that I should try to run another test and bingo! It worked as usual. Then I decided to rewrite the "problematic" test from scratch. During rewriting I caught myself thinking that I forgot to mock/define some dependencies of the class under testing.
Recently, I added Clock to my class
private final Clock clock;
After defining this dependency in the test class the issue has gone
var clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);
I see that the question was asked a couple of years ago, but I believe it could be useful for someone.