I am trying to generate large (i.e. 6740x4768 points) vector map outputs with Mapnik in a <a href="https://sourceforge.net/p/pnkmap/code/ci/ee6b8efd35844e27fa78ce8c6c58ac206c8e291c/tree/Devel/export/export.py">Python script</a>, but Cairo is unable to generate large PostScript files due to high memory consumption (>4GB), where PDF files could be generated with much lower (~500MB) requirements.
The high memory usage is caused by the use of fallback images. When drawing operations that are not natively supported by PostScript are used on the PostScript surface cairo will output fallback images containing the unsupported operations. Cairo will try to find the smallest set of rectangles that will enclose all unsupported operations and output fallback images for these rectangles.
It looks like in your case cairo needs to generate a fallback image for the entire page. You can reduce memory usage by lowering the resolution of the fallback images (cairo_surface_set_fallback_resolution).
If the PostScript you are generating contains the same content as the PDF file in bug 44573 the problem is the use of transparency. While PDF supports transparency, PostScript does not. If you can restrict yourself to only using opaque colors you will avoid the need for fallback images.
What we can do inside Cairo is to tile such large fallback images into manageable chunks, such as 2048x2084?
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/151.