Out of memory when flyway installs several migrations

Hello,
I'm using Flyway in a Spring Boot (3.0.9) application with about 100 migration files. The largest migration occupies 138 MB and the application has a Java heap space of 384 MB (-Xmx384m).

When I start the application with an empty database, Flyway can not execute all the migration because of Out of Memery exception (09:42:06.188 [restartedMain] DEBUG org.flywaydb.core.FlywayExecutor - Memory usage: 336 of 384M).
Instead, if some of the migrations are already istalled (approximately half) before the start up, Flyway executes the missing migrations and the application start correctly.

Analysing the heap dump of the OoM case I see that threre are a lot of istances of class org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.


Why is memory occupancy lower when the migrations are installed in two runs?

Is it possible that Flyway accumulates memory space for each installed migration?
If so, is there any configuration to avoid it?

Thank you in advance.


Versions:
Flyway Java API 9.5.1, Maven plugin 9.16.1, MySql 8.0

Tagged:

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file