[zone] Fix bad suggested mem calculation

Because the calculation didn't take the hunk header size (which is not
included in the hunk size) into account, the conversion to MB was one
short and thus the rounding up to the next 8 MB boundary was giving the
current total hunk size (ie, the already given size). Most confusing to
a user ("But I already asked for 128MB!").
This commit is contained in:
Bill Currie 2022-05-31 20:48:50 +09:00
parent ef64161835
commit 520371a3aa

View file

@ -722,7 +722,7 @@ Hunk_RawAlloc (memhunk_t *hunk, size_t size)
Hunk_HighMark (hunk); // force free of temp hunk
}
if (hunk->size - hunk->low_used - hunk->high_used < size) {
int mem = hunk->size / (1024 * 1024);
int mem = (hunk->size + sizeof (memhunk_t)) / (1024 * 1024);
mem += 8;
mem &= ~7;
Hunk_Print (hunk, 1);