mem: make segment preallocation OS-specific