Memory Leak drawing SVG?


#1

Hi…

I’ve been writing my app primarily in XCode, but recently made a Windows build to test things out… turns out I now see a memory leak in my output window, shutting down.

After some testing, it seems that there’s a bug drawing my SVG graphics…
I’ve duplicated the leak in the Juce Demo app by adding one DrawableButton with a SVG graphic.

I’ve added these lines to the bottom of the PathsAndTransformsDemo consructor.

DrawableButton *pButton = new DrawableButton(T("Mem Leak"), DrawableButton::ImageFitted);
		
File file(File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() + File::separator + "Test.svg");
jassert(file.exists());
pButton->setImages(Drawable::createFromImageFile(file));
		
pButton->setBounds(100,400,200,200);
addAndMakeVisible(pButton);

Obviously, to duplicate this, you’ll need the SVG file (I think – I’m guessing that i’ve got something complex going on in my graphics)…
Is there no way to attach files here?
I’ve posted it here … can you work with this? http://www.jamesinkster.com/test/Test.svg

Thanks.
james.


#2

Are you sure it’s not just the fact that you’re leaking this DrawableButton?


#3

Ahhh…
Not leaking the DrawableButton (deleteAllChildren is called in teh PathsAndTransformsDemo’s destructor), but leaking the image.

I just re-read the docs and correctly interpreted them, this time. I mistakenly read that the image keeps the images, but in fact it keeps its own COPIES of the images.
Sorry about that!

j.


#4