Bug 30187 - MemoryError after many calls to Context.set_font_matrix
Summary: MemoryError after many calls to Context.set_font_matrix
Status: RESOLVED NOTOURBUG
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Windows (All)
: medium normal
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 08:33 UTC by Wouter
Modified: 2010-11-01 04:22 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
This a an example script which shows the problem (657 bytes, text/plain)
2010-09-14 08:33 UTC, Wouter
Details
updated test (1.11 KB, text/plain)
2010-09-17 00:37 UTC, Steve Chaplin
Details

Description Wouter 2010-09-14 08:33:56 UTC
Created attachment 38698 [details]
This a an example script which shows the problem

While drawing a lot of text-items with different rotations appied to them (a graph with arc-flows displayed) I encountered a MemoryError. I've managed to isolate the problem to a lot of calls to Context.set_font_matrix, which crashes on my computer after ~5000 calls (see the included attachment). 

A workaround for me was to reduce the amount of calls to set_font_matrix - this can be done by only allowing a limited amount of angles and drawing all text-items for one specific angle at once.

I'm curious whether the problem is a pyCairo problem, a Cairo problem, a Windows problem or just bad programming from me :-)

Regards,
Wouter
Comment 1 Steve Chaplin 2010-09-17 00:37:52 UTC
Created attachment 38753 [details]
updated test
Comment 2 Steve Chaplin 2010-09-17 00:39:36 UTC
For the example script I would recommend using xrange (or while) instead of range - to avoid allocating a long list of integers in memory.

On Linux (with 2GB ram) the script runs ok to 10,000. But I can see memory use increasing, which may be a problem.

I updated the example script to look for a memory leak in Python.
On my system the number of objects is constant, and the number of uncollectable objects is constant and zero - so it does not look like a Python or pycairo problem to me.

You could try translating the test script into C and see if the memory use
still increases. That should tell you whether it is a C or Python problem.
Comment 3 Steve Chaplin 2010-11-01 04:22:13 UTC
Closing as the problem reported has not been demonstrated to be a pycairo bug, and it looks unlikely that there will be any progress on the issue.


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.