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 overflow #814

Closed
Gaubee opened this issue Sep 2, 2024 · 3 comments
Closed

Memory overflow #814

Gaubee opened this issue Sep 2, 2024 · 3 comments

Comments

@Gaubee
Copy link

Gaubee commented Sep 2, 2024

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1"
    width="934.975830078125" height="1024" viewBox="0 0 934.975830078125 1024">
    <defs>
        <filter id="master_svga_90_04879" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-120"
            y="-120" width="619.9678649902344" height="376.67909240722656">
            <feFlood flood-opacity="0" result="BackgroundImageFix" />
            <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
            <feGaussianBlur stdDeviation="30" result="effect1_foregroundBlur" />
        </filter>
    </defs>
    <g>

        <g filter="url(#master_svga_90_04879)">
            <path
                d="M246.02157592773438,863.812059375L410.03657592773436,978.622359375L625.9895759277344,841.943359375L410.03657592773436,913.016459375L246.02157592773438,863.812059375Z"
                fill="#FEFFE1" fill-opacity="1" />
        </g>
    </g>
</svg>

just try this svg.
version 0.42.0~0.43.0

@RazrFalcon
Copy link
Owner

Yes, this is an expected behavior. There are no memory usage limits in resvg.
I assume you wanted to use filterUnits="userSpaceOnUse" instead of filterUnits="objectBoundingBox". Because right now your SVG requesting a 235567x51484px image.

@Gaubee
Copy link
Author

Gaubee commented Sep 2, 2024

Yes, this is an expected behavior. There are no memory usage limits in resvg. I assume you wanted to use filterUnits="userSpaceOnUse" instead of filterUnits="objectBoundingBox". Because right now your SVG requesting a 235567x51484px image.

Thank you for your response. I'm not an SVG expert; I'm just using resvg as the solution for rendering SVGs in my application.
I'm currently using it as a dynamic link library to meet the SVG rendering needs in mobile. This leads to unbounded memory usage, causing the application to crash. Do you have any suggestions for this?

@RazrFalcon
Copy link
Owner

Currently, there are no plans on adding memory usage limits.

All you can do right now is too walk over nodes and check their bboxes. But if you're using resvg as a C library then there is no way to do so either.
Or you can fork resvg and add necessary checks yourself.

I have added #815 to track this issue.

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