PDA

View Full Version : qsvgwidget load



talk2amulya
4th July 2009, 11:01
Hi All,
feels good to be back here again, this time with a problem. i m facing an issue with QSvgWidget's load() function.The issue is that we have the contents of an svg file as a bytearray, and we change the contents of the bytearray on the fly A LOT. Now these contents have references to 4/5 different svg files inside it too. So, everytime we change the bytearray of svg and load it again, the memory increases drastically.
My initial thought was that probably the previous renderer isnt getting deleted. But digging deeper into the code, i found that deleting renderer is the first thing happening, causing a miniature fall in memory consumption, all good till now. Now the svg handler takes the new bytearray and loads it, all good again..next comes the repaintneeded() which causes a update() of widget and all hell breaks loose. memory consumption is huge now.
Clearly the new paintevent() generated is taking up all the memory but the thing is that why isnt the paintevent() releasing the previous memory on the next update.
I wasnt convinced that Qt has such a drawback with svg drawing so i created a test application which loads 12 svgs one after another. Surprisingly, i noticed memory decreasing sometimes. So my guess is that since our bytearray has references to svgs in it, it causes some messing up of data inside everytime an update() occurs, causing sort of chain updates of svgwidget. Does anyone have any clue of whats happening under the hood?
Any pointers are appreciated. In any case, i'll have to contact trolltech guys for this since this is really an appalling behavior.

jpn
16th July 2009, 17:02
How do you measure the memory consumption? Is there any other application that would require memory?