[.net] Memory leaks with 3d files in WPF

Started by
1 comment, last by Winegums 16 years, 10 months ago
the WPF app i'm currently writing features a xaml file with a 3d object. this file is called often during the programs running to display a transition screen between one page and another. however frequent calls to this page seem to result in a gradually increasing memory leak. Since I'm not explicitly deleting anything, I understand how this could be the case. Is there some way to unload the page from memory during execution?
Advertisement
Your description is too vague give a specific answer, so I'll give a generic one.

Make sure that references to any extra, unnecessary objects (such as are used to create this xaml file?) are set to null. And make sure you call Dispose on any IDisposable objects.

For example, and this is totally hypothetical, suppose you're creating the xaml file in a buffer in memory each frame, and not setting it to null. Those won't be cleaned up, as the garbage collector will see that references to them still exist in active code.

Another example: if you're using managed directx or xna (and again, the vagueness of your post makes this impossible to know), call Dispose on any objects you temporarily create while creating the xaml file.
Hi, thanks for your reply. sorry about the vagueness, I wasn't sure what you needed to know. i'm using c# for the backing for these files.

The model data is held within the .xaml file used for transition screens.

The page isn't unloaded at any point, but rather a new instance is added to the display surface each time the page is changed. None of the material I've looked at has covered deleting old pages from memory.

EDIT: managed to sort it. iterate through teh scene, grab the UI elements, remove them.


[Edited by - Winegums on June 12, 2007 9:38:44 AM]

This topic is closed to new replies.

Advertisement