On 17/01/2022 12:19, Dmitry Yemanov wrote: > > Why is it done this way? AFAIU, impureCount is known during the compile > time, so the whole impure area could be preallocated during the prepare > stage. >
There are others similar patterns, see irsb_message for example. The size is know at compile time. To allocate directly, it would need a rpt structure or different impure offsets. This pattern is used with irsb_mrg_rpt. It's a bit uglier and it looks like it waste a bit (sizeof(Impure::irsb_mrg_repeat)) of memory here since it's already present one time in the struct: const size_t size = sizeof(struct Impure) + count * sizeof(Impure::irsb_mrg_repeat); Adriano Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel