Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of memory on surface finish #239

Closed
eleroy opened this issue Jun 24, 2021 · 7 comments
Closed

Out of memory on surface finish #239

eleroy opened this issue Jun 24, 2021 · 7 comments
Labels

Comments

@eleroy
Copy link

eleroy commented Jun 24, 2021

In python 3.8, windows 10 x64, pycairo 1.20.1:

import cairo

with cairo.PDFSurface("example2.pdf", 200, 200) as surface:
    pass

surface = cairo.PDFSurface("example.pdf", 200, 200)
surface.finish()

The call with the context manager works, but the last line surface finish throws an out of memory error. This is now only possible to use the surface within the context manager for some reason ?

Does anyone have the same issue ?

Thank you

@eleroy
Copy link
Author

eleroy commented Jun 24, 2021

Everything is working with these builds:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo

@msh0
Copy link

msh0 commented Jun 7, 2022

Got exactly the same thing. Windows 10 64-bit, Python 3.9.1, pycairo 1.21.0.
I also noticed the following crashes likewise (with cairo.MemoryError: out of memory at the show_page() call):

import cairo
with cairo.PDFSurface("test.pdf", 200, 200) as surface:
    cairo.Context(surface).show_page()

Basically pycairo is unusable for me here.

@msh0
Copy link

msh0 commented Jun 7, 2022

Everything is working with these builds:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo

Worked with the build found here, many thanks (this .whl collection has saved my skin quite a few times before). But the PyPI version remains entirely useless.

@eddiethehuman
Copy link

Everything is working with these builds:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo

@eleroy you're a champ. This solution really just saved me hours worth of headaches.

@naveen521kk
Copy link
Contributor

naveen521kk commented Jun 11, 2022

Yeah, I can reproduce the error. On the packages version of Cairo on PyPI, I found the Cairo version bundled to be

>>> import cairo
>>> cairo.cairo_version()
11702

and on the wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo, it's

>>> import cairo
>>> cairo.cairo_version()
11600

So it must be something with the version of the library used. Also, the most recent version is 1.17.6 (developmental release) and I'll try and see if I can reproduce it there. I should also work on #243 someday.
Edit: No I can't reproduce with wheels built with recent version 1.17.6

>>> import cairo
>>> cairo.cairo_version()
11706
>>> surface = cairo.PDFSurface("example.pdf", 200, 200)
>>> surface.finish()

@lazka
Copy link
Member

lazka commented Nov 28, 2022

I can reproduce the issue with 1.22.0, but with 1.23.0, which includes the new cairo build everything seems to work now.

So I think this is fixed in the latest release.

@lazka
Copy link
Member

lazka commented Jun 10, 2023

I assumed this was fixed in cairo then.

@lazka lazka closed this as completed Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants