sh: rework memory limits to work with LMB.