[cairo] OutOfMemory errors

Owen Taylor otaylor at redhat.com
Tue Jul 3 11:11:18 PDT 2007

On Sat, 2007-06-30 at 10:29 -0700, Travis Griggs wrote:
> The Cairo binding for VisualWorks Smalltalk has been picking up
> excitement and more and more people are playing with it.
> One of the issues here though is that many of these (rather, most),
> have been Windows users. And I'm getting lots of reports of "out of
> memory" errors. Someone was kind enough to hint to me to the situation
> where the out of memory error code is doubling as a "generic backend
> error" error code. I went and looked at the code and could indeed see
> where at least on Win32, many win32 errors are being stderr printf'ed
> VisualWorks is not usually a program people run from a command line
> where they'll see these messages.
> I'm curious what, if anything, could be done to improve the situation.
> I'd even be willing to attempt the code if there was some consensus
> about how to better solve the problem. Would be adding a new kind of
> "BackendSpecificError" be enough of a start?

What needs to be done is track down *why* these backend-specific 
errors are being generated. There's little or nothing that a user should
be able to do to produce a GDI error, and thus reporting them back to
as GDI errors doesn't help the situation, except a tiny bit by being
less confusing.

Making the errors into fatal assertions would allow things to be tracked
down much more easily, either with a debugger or with a stacktrace
collection tool like Google Breakpad, but has the big disadvantage of
making the errors fatal in cases where they *don't* indicate some 
problem in the Cairo framework, but a real out-of-memory error, or
some other harmless condition.

For now, really, what you need to do is get reproducible test cases
from your users, and then reproduce them under a debugger with a 
breakpoint in _cairo_win32_print_gdi_error().

					- Owen

More information about the cairo mailing list