[cairo] Out of memory when creating a large pdf

Lufy D.Monkey lufy2012 at yahoo.ca
Tue Jul 13 20:26:38 PDT 2010

As long as you are using the Visual C++ I guess you can put the break-points on 
all the lines that contains the "CAIRO_STATUS_NO_MEMORY" returns in the 
cairo-pdf-surface.c and catch the error. Sometimes cairo returns 
"CAIRO_STATUS_NO_MEMORY " dosen't mean that it is really out of memory but other 
errors (for example, the win32 backend).


From: gnappen <gnappen at gmail.com>
To: cairo at cairographics.org
Sent: Tue, July 13, 2010 6:42:03 AM
Subject: [cairo] Out of memory when creating a large pdf


I am trying to build a large ancestor tree in to a single page pdf with cairo. 
It consists of lines, circles and text for about 12000 individuals. I know that 
the pdf format can handle it, as this ancestor tree has been done manually with 
Coral Draw. The pdf isn't that big in size, but it contains a large amount of 
objects in one single page.

When I get about halfways I get the CAIRO_STATUS_NO_MEMORY error.

I have tried cairo_pdf_surface_create_for_stream(), hoping to be more in control 
of how much is in memory, but I get the out of memory error from cairo before 
the callback is called.
The only way I've found so far to flush the buffer and avoid running out of 
memory is by calling cairo_show_page(). That will emit the data in the stream, 
but then I get a pdf with more than one page! :-(

Is there anyway of flushing the data from memory to the file without switching 
to a new page?
Or any other suggestions?

My enviroment is Win Vista, Visual C++, using Cairo binaries v1.8.10 from GTK+.


cairo mailing list
cairo at cairographics.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100713/d09fb85b/attachment.html>

More information about the cairo mailing list