(v13) Best practice in allocating buffers from the Core
This page applies to Harlequin v13.1r0 and later; and to Harlequin Core but not Harlequin MultiRIP
If you need to allocate band buffers (or other large buffers) from the Core (using MemAlloc
), we strongly recommend doing so during interpretation (in the RasterRequirements
method); however, care should be taken because that is typically called multiple times during page initialization as various configuration items change the page dimensions, etc.
Allocating memory in RasterStart
is not recommended because the skin only calls it when the first band is output to a page. At this point, even if the interpreter may have allocated large amounts of memory, and all available Core memory may have been allocated for the band buffers. If an allocation fails during rendering, there are very few low-memory strategies available, so it will raise an error and abort the job. By contrast, for allocations made in RasterRequirements
, Harlequin has the option to apply a number of different low-memory strategies to ensure that the job can run to completion.
NOTE: This memory allocation only applies if you're not using static band buffers or allocating them from OS memory.