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

Why does webrender take nearly 100 MB of RAM when rendering text? #3222

Closed
fasihrana opened this issue Oct 21, 2018 · 3 comments
Closed

Why does webrender take nearly 100 MB of RAM when rendering text? #3222

fasihrana opened this issue Oct 21, 2018 · 3 comments

Comments

@fasihrana
Copy link

fasihrana commented Oct 21, 2018

I've been working on a GUI framework with webrender as the rendering engine. I've noticed that the RAM consumption is about 100MB when I start rendering text. This happens on both Windows and Ubuntu. I understand that text rendering is quite complex and calculation intensive, but doesn't 100MB RAM seem a bit too much? Maybe I'm doing something?

You can find the code sample here: fasihrana/skryn.

With text rendering:
alt text

Without text rendering:
alt text

The difference between both these runs is that for the run without text rendering I've commented out the following line:
line 166: map.insert(c, (gi[i], gd));

@gw3583
Copy link
Contributor

gw3583 commented Oct 21, 2018

This is probably caused by the lazy allocation of the texture atlas.

WR will only start allocating memory for the texture cache once an image / glyph is placed in it for the first time. Unfortunately, the texture cache is currently a large, fixed size. The downside is that there is an immediate jump to a large memory usage - but on the plus side, there generally won't be any further allocations made, even as you add thousands more glyphs / images.

There is some ongoing work by @bholley to make the texture cache start out much smaller, and grow as required, which should fix this.

@fasihrana
Copy link
Author

Thanks for that explanation.

@gw3583
Copy link
Contributor

gw3583 commented Feb 4, 2019

The texture cache now starts very small and grows as required, so I think this will be resolved.

@gw3583 gw3583 closed this as completed Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants