You might consider taking the database(s) out of WAL mode during a migration.

That would eliminate the need for shared memory.