B
Big D
I'm trying to write a game in c# using managed direct3d, and I have a bit
of a situation. I'm using sprites to draw my 2d graphics, and I'm
generating some of my sprites dynamically by writing to Bitmaps, then
saving the Bitmaps to a MemoryStream that I load as a texture using
Device.FromStream.
My problem is that using this method seems to cause a memory leak over
repeated calls to FromStream. It looks to me like when I call FromStream,
Direct3D keeps a reference to my stream so it doesn't get GC'd.
I've tried re-using the same MemoryStream and setting the Position to 0
each time, and I've tried using a new MemoryStream each time.
I'm using a somewhat old version of DX9, so maybe (hopefully?) it's fixed
now, but I wanted to know if anyone could give any advice or tell me if
this was a known issue.
Thanks!
of a situation. I'm using sprites to draw my 2d graphics, and I'm
generating some of my sprites dynamically by writing to Bitmaps, then
saving the Bitmaps to a MemoryStream that I load as a texture using
Device.FromStream.
My problem is that using this method seems to cause a memory leak over
repeated calls to FromStream. It looks to me like when I call FromStream,
Direct3D keeps a reference to my stream so it doesn't get GC'd.
I've tried re-using the same MemoryStream and setting the Position to 0
each time, and I've tried using a new MemoryStream each time.
I'm using a somewhat old version of DX9, so maybe (hopefully?) it's fixed
now, but I wanted to know if anyone could give any advice or tell me if
this was a known issue.
Thanks!