Memory leak reading SVG image

Achim Domma <[email protected]> Thu, 06 Oct 2005 11:47:18 +0200
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <[email protected]>
Hi,

the following sample application consumes more and more memory. Am I 
doing something wrong or is this a memory leak in reading svg files? I 
tried it with GM 1.1.4 and the current snapshot. The example svg file is 
pasted below the code sample.

regards,
Achim

------------------------------------------------------------
int _tmain(int argc, _TCHAR* argv[])
{
     std::fstream source("demo.xml");
     std::string data;
     std::copy(
         std::istreambuf_iterator<char>(source),
         std::istreambuf_iterator<char>(),
         std::back_inserter(data)
         );

     Magick::Image image;

     for (int i=0 ; i < 10000 ; ++i) {
         Magick::Blob blob(data.c_str(), data.size());
         image.magick("SVG");
         image.read(blob);
     }
     return 0;
}
------------------------------------------------------------
<?xml version="1.0" encoding='iso-8859-1'?>
<svg width="130" height="210" style="fill:rgb(255,100,100)">
	<rect width="130" height="230" style="fill:wheat;"/>
	<rect width="20" id="rect_min" height="-50.0660922139395" 
transform="translate(10,115)" style="fill:#75d0b9; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="20" id="rect_avg" height="-68.6202397212709" 
transform="translate(35,115)" style="fill:#a999e3; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="20" id="rect_max" height="-100" 
transform="translate(60,115)" style="fill:#b9d075; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="20" id="rect_original" height="-65.4329117227247" 
transform="translate(85,115)" style="fill:#e599ac; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="10" id="box_min" height="-10" 
transform="translate(10,135)" style="fill:#75d0b9; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="10" id="box_avg" height="-10" 
transform="translate(10,155)" style="fill:#a999e3; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="10" id="box_max" height="-10" 
transform="translate(10,175)" style="fill:#b9d075; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<rect width="10" id="box_original" height="-10" 
transform="translate(10,195)" style="fill:#e599ac; stroke-width:1; 
stroke:rgb(0,0,0)"/>
	<text id="label_min" x="25" y="135" font-family="Arial" font-size="12" 
fill="black">30,30 Euro</text>
	<text id="label_avg" x="25" y="155" font-family="Arial" font-size="12" 
fill="black">41,53 Euro</text>
	<text id="label_max" x="25" y="175" font-family="Arial" font-size="12" 
fill="black">60,52 Euro</text>
	<text id="label_original" x="25" y="195" font-family="Arial" 
font-size="12" fill="black">39,60 Euro</text>
</svg>
------------------------------------------------------------



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl