SourceForge has been redesigned. Learn more.
Close

#16 Memory allocation error on vector graphics (or mem bomb)

closed-fixed
None
5
2010-02-09
2010-02-08
No

For realy large pathes render.c have dubious calculation algorithm of memory reallocation

1st pass estimate number of points in path (May be field for optimization)
Imagemagick's code try to allocate memory for new points 6*BezierQuantum*length/3-1 (example: For Path with 8000 points one will try to allocate space for 3 000 000 additional points BezierQuantum = 200 --> about 300 Mb array of PrimitiveInfo[])

I suggest to use following formula to ensure additional space allocated for all points of path:

Reserved Memory size is:
path_max_points = length *3/2
Where:
length - Number of tokens (length)
*3 - Maximum points number to render one segment with bezier
/ 2 - 1 point have 2 coords
+Some additional 6*BezierQuantum+360 - some approximation stuff had taken from TraceStrokePolygon code

Discussion

  • Vladimir Lukianov

    memory reallocation

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2010-02-08

    Are you able to also supply the path_memalloc_100112_mos_Trud_002_cut_2_i002_bkgnd.gif that this SVG seems to require?

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2010-02-09

    Your patch has been applied to GraphicsMagick CVS. Thank you very much for spotting this and preparing the patch.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2010-02-09
    • assigned_to: nobody --> bfriesen
    • status: open --> closed-fixed
     

Log in to post a comment.