Skip to content

Use ceil on svg dimensions, fix svg memory usage ref #841 #952

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

Merged
merged 1 commit into from
Jul 21, 2021

Conversation

aentity
Copy link
Contributor

@aentity aentity commented Jul 14, 2021

Calls ceil() on dimension bounds as this appears fix svg memory
unbounded usage because no longer cache miss.

The height and width return from resvg seem to always be ceiling
of float dimensions, so we try to match.

@@ -122,6 +122,7 @@ impl Cache {
device,
encoder,
)?;
log::warn!("allocating {} {}x{}", id, width, height);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be debug or trace level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i changed to debug. i do think warn is useful to see how much allocating, since it should really be never once application is running, but i do see it reallocating if for example i change svg icon / button depending on some state, but it's ok for me to make debug

@hecrj hecrj added the bug Something isn't working label Jul 15, 2021
@hecrj hecrj added this to the 0.4.0 milestone Jul 15, 2021
Calls ceil() on dimension bounds as this appears fix svg memory
unbounded usage because no longer cache miss.

The height and width return from resvg seem to always be ceiling
of float dimensions, so we try to match.
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants