Thanks for the tip! Updated with shm_realloc() now. Also rebased with master, and the check seems to be successful.
I'm currently also investigating a deadlock issue (#3641), but it doesn't seem to be related to changes in this PR. Any feedback there would be helpful too.