Fix a bug in the heap size calculation, where a negative result wasn't
noticed because we're working with unsigned types. We now explicitly
test that the heap has enough room for the minimum allocation area
size, otherwise a heap overflow is reported.