Whats the proper way to reload a svgviewbox control?
I have a scenario where I am wrapping a zoompanel around a svgviewbox that I need to load/reload many times. Currently I am simply setting the Source property to a new svg file, but after a couple times, I start getting out of memory errors. Is this the correct way to change the source, or is it not designed to do this?
It is correct to just change the Source property of SvgViewbox.

I have checked the control again and do not see any increase of memory or leaked handles when the Source is changed multiple times.

Maybe you have some references to the read objects from your code that do not allow Garbage collector to free them.

Could you please check your application with task manager or process explorer and check if the memory is increasing constantly. Also please check for references from your code (note that subscribing to events on read objects also adds a reference to the objects).

Do you get the error just on specific files or any files (after some time). Sometimes the out of memory exception is thrown when the images embedded into svg file are not correctly defined - for example the data for the image wants to create an image with size 10000 x 20000.

If you still do not find the cause please create a simple application with some of your svg files that could be used to reproduce the problems. Please send your application on the feedback form (http://www.wpf-graphics.com/Feedback.aspx)
Andrej Benedik
I am still trying to isolate this issue, but I still cant find a cause. I have commented all my code out that touches the read svg file in anyway, so the only code left is what sets the source. I have found through testing that on first load, the memory is around 300K which I would expect since my svg file is rather large. When setting the source to a different svg file, the memory immediately doubles to 600K+ and does not go back down. This occurs only on the line that sets the source. I don't subscribe to any events other than the SvgFileLoaded event on the svgviewbox. I am putting together a sample project for you to test with and will get it to you shortly.
I put together a sample project to repro this issue and emailed it to you. If you do not get it, it may be because the file attachment was too large. Let me know whether you got it or not.

Forum Jump:

Users browsing this thread:
1 Guest(s)