Replacing mlock with a loop of memory setting - due to OS limits.