[util] Fix handling of sline's list 'pointer'

I forgot to right-shift the value so offsets were becoming 0 or 8
instead of 0-15. This fixes the management of small objects. It turns
out that after this fix, qfvis's problems were caused by fragmentation
in the windings. Need to revisit line allocation and use POT-specialized
pools.
This commit is contained in:
Bill Currie 2020-12-30 18:12:28 +09:00
parent 9090c53519
commit efdbd59909

View file

@ -377,7 +377,7 @@ cmemfree (memsuper_t *super, void *mem)
// sub line block
sline = (memsline_t *) ((size_t) mem & ~(MEM_LINE_SIZE - 1));
*(uint16_t *) mem = sline->list << 2;
sline->list = (size_t) mem & (MEM_LINE_SIZE - 1);
sline->list = ((size_t) mem & (MEM_LINE_SIZE - 1)) >> 2;
super_sline = &super->last_freed[sline->size];
if (*super_sline != sline) {
if (sline->next) {