Hey,

I'm currently implementing a bump allocator to learn about the Allocator trait.

The documentation for grow and shrink states:

Note that new_layout.align() need not be the same as old_layout.align().

My intuition was that these functions are used by container types when the number of elements changes. In these cases the alignment will stay the same, or am I missing something?

Are there other common usages of the grow/shrink where the alignment does changes?

2 posts - 2 participants

Read full topic