
[Michael Chermside]
... I'm sure this is just pointing out the obvious, but *IF* the list header were increased, we could add TWO fields... According to Tim, this would still "only" bump list objects up to 24 bytes, but ...
There's something else to note here, in connection with the realloc-avoiding list patch/hack I posted yesterday: for that logic to work, a non-empty list must always contain enough slots for roundupsize(ob->size) elements. So, for example, a list of length 1 must nevertheless contain room for 8 objects, which on a 32-bit machine is 7*4 = 28 bytes in the list *guts* it doesn't need today (but does need after that patch). So if people like that patch, it would be more *memory*-efficient too to drop the roundupsize() business and just expand the list header to remember how many slots have been allocated. Then no overallocation would be needed. Adding 8 bytes in the list header should be a net win over asking for up to 28 unused bytes in the guts (of small lists; it can be larger than that for large lists).