Headroom defined for max sizes with correct handling

RUBY-676