Bug 44572

Summary: PS backend has too high memory requirements (much higher than PDF or SVG)
Product: cairo Reporter: Petr DlouhĂ˝ <petr.dlouhy>
Component: postscript backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Petr DlouhĂ˝ 2012-01-08 05:18:14 UTC
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.
Comment 1 Adrian Johnson 2012-01-09 03:26:51 UTC
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.
Comment 2 Chris Wilson 2012-05-01 09:42:28 UTC
What we can do inside Cairo is to tile such large fallback images into manageable chunks, such as 2048x2084?
Comment 3 GitLab Migration User 2018-08-25 13:42:22 UTC
-- 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.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.