Suppose I'm an allocator which only has power-of-2 sized spaces to hand out, and you're a growable array type and you want enough space for 20 of your 52 byte entries. So that's 20x52 = 1040 bytes, but my smallest suitable space is 2048 bytes. I can give you that space, but it seems like it'd be nice for me to say oh, here's 2048 bytes, and now the growable array type knows its new total capacity is not 20 but 39.
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;
You can get the length of the returned byte slice (`[u8]`) to know how many bytes were actually allocated.Yes I'm aware that I can ask how long a slice is.
It's even worse for types like HashMaps where reallocs can be much more expensive than just a big memcpy.