Add initialisation of shared memory

Targets #111.