I am trying to solve stutter in my game caused by garbage collection so I ran a memory profiling on my WP8 device. The result which spans a 1 second slice is here. On app start I go through all my textures and load them via the ContentManager, and it is my understanding once a texture is loaded, any subsequent loads of it will return the same texture, therefore no more than 1 instance of that texture is loaded. But the memory profiler reports many instances of SharpDX.Direct3D11.Resource and SharpDX.Direct3D11.Texture2D being created throughout the game, after I loaded all the textures. The method that seems to cause the creation of SharpDX.Direct3D11.Texture2D for example is this but I do not understand what it is or how to reduce the amount of garbage caused by it, if at all possible.
Hi,
Could you post some relevant code that expose this problem?
Well, yes, but unless you are running a perfectly empty project (which does not seem to be the case), these calls are consequences of how you wrapped up your project and how you are using textures and render targets. A profiler heap snapshot does not tell the whole story.
I created a sample project complete with a memory profile report within that showcases the issue. The project itself is as close to an empty project as possible, just a 1 pixel generated texture scaled up. Dropbox link here
No replies in a while… no one knows what is creating all these objects?
I just checked your screenshots (I am on mobile) and they look familiar.
The touchCollection garbage has been partially resolved.
The garbage in UpdateTarget is known but for now can only be hacked way under some conditions. For a true solution an issue with sharpDX must be resolved first. That issue also generates garbage and has been reported as well at sharpDX github.
Take a look at the following for a description of the issues.