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

Memory leak in FillText #136

Closed
jimlears opened this issue Dec 13, 2011 · 6 comments
Closed

Memory leak in FillText #136

jimlears opened this issue Dec 13, 2011 · 6 comments
Labels

Comments

@jimlears
Copy link

(commented on issue #135 in reference to the Context2d leaks that are also in here)

canvas = new Canvas(500, 500); 
ctx = canvas.getContext('2d');
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = '#ebebeb';
ctx.font = "32px 'Gotham Black'";
ctx.shadowColor = "#333";
ctx.shadowColor = "#252525";
ctx.shadowOffsetX = 0.1;
ctx.shadowOffsetY = -1;
ctx.shadowBlur = 0;
ctx.fillText("hello world", 10, 10);

ss
ss2

@jimlears
Copy link
Author

Follow up: Appears to be leaks all over the place.

ss

@Tharit
Copy link
Contributor

Tharit commented Dec 13, 2011

Regarding your first screenshot, those are the two leaks I fixed in my patch.

However, the problem in Context2d::SetFont seems to be related to the internals of 'cairo_select_font_face'. ]
As the documentation explicitly declares this as a "toy" function, it might be neccessary to switch to using a "real" font backend like cairo-ft. I'll try to investigate this.

@tj
Copy link
Contributor

tj commented Dec 14, 2011

The toy function worked out quite well for what we needed, I'm assuming toy doesn't mean it'll have memory leaks, that would be a little odd but that might be the case

@jimlears
Copy link
Author

It seems -- I am not 100% sure, though -- that the fix that releases that array of states in the Context2d destructor and called cairo_path_destroy() in Context2d::restorePath() has also made the (seemingly) SetFont leaks go away. Not getting those leaks in Instruments any longer.

@Tharit
Copy link
Contributor

Tharit commented Dec 15, 2011

I can still observe that leak with my patches - however, it appears that not every call to SetFont leaks...

@Tharit
Copy link
Contributor

Tharit commented Dec 15, 2011

It appears that the leak in FcPatternObjectInsertElt might be incorrectly reported by valgrind. It's suppressed in tests for other applications like for example gtk and chrome.

See:
http://src.chromium.org/svn/trunk/src/tools/valgrind/memcheck/suppressions.txt
https://bugs.freedesktop.org/show_bug.cgi?id=8428

Additionally, I have been running a node server serving several hundred images per hour for the last 4 days, and memory usage is not increasing (at least not noticeably).

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

4 participants