I loaded my textures with FromStream method and I noticed a problem that those textures are being ignored by garbage collector. I even nulled them, called dispose on them and tried to force garbage collector - they're still in the memory. Any ideas why this might be happening?

  • \$\begingroup\$ did you try something like ContentManager.Unload() ? stackoverflow.com/questions/4264995/… forcing garbage collection is really bad for performance \$\endgroup\$ – dimitris93 Feb 19 '15 at 7:44
  • \$\begingroup\$ I am not using ContentManager. As I mentioned in my question, I use Texture2D.FromStream method to load it directly into memory. \$\endgroup\$ – TommyGun93 Feb 19 '15 at 12:32
  • \$\begingroup\$ Never mind. I found a solution. \$\endgroup\$ – TommyGun93 Feb 19 '15 at 12:55
  • \$\begingroup\$ Could you write your solution please ? To help the people who will face the same problem. \$\endgroup\$ – Heckel Feb 21 '15 at 14:53

I forgot to call Dispose() on texture loaded with FromStream().

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.