Make max number of orphan blocks kept in memory a startup parameter

Fixes #4253