On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote:
It's rather simple, just take a look at its source code in std.array.
It's an ordinary linear array partially filled with your data.

[...]

2. Up until 4 KB it reallocates when growing, but after 4 KB the array lives in a larger pool of memory where it can often grow a lot without reallocating, so in many scenarios where other allocations do not interfere, the data array of appender grows in place without copying any data, thanks to GC.extend() method.

I always assumed it kept its own manually allocated array on a malloc heap :O

Hence a practice of using .dup and .idup on the .data member when you're happy with the result?

Reply via email to