   D3D out of memory error
  Got this code in my Render method, which is called from my main loop   private void Render()   {  if (device == null) return;   // no device = do nothing  device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);  device.BeginScene();  Sprite background = new Sprite(device);    background.Begin(SpriteFlags.None);  background.Draw2D(playfieldTexture, new Rectangle(0, 0, 800, 600), new SizeF(800f, 600f), new Point(0, 0), Color.White);  background.End();    device.EndScene();  device.Present();   }If I give it like 30 seconds (can trigger it to happen faster if i move the window) - I get a D3D out of memory exception on this line:  background.Begin(SpriteFlags.None);Using the "using" statement I seem to be able to get the issue to dissapear, but it would be nice to understand why it happens.Seemingly working code:  using (Sprite background = new Sprite(device))  { background.Begin(SpriteFlags.None); background.Draw2D(playfieldTexture, new Rectangle(0, 0, 800, 600), new SizeF(800f, 600f),new Point(0, 0), Color.White); background.End();  }For the record, this is the code that creates the device: PresentParameters presentParams = new PresentParameters(); presentParams.Windowed = true;    // QQQ support fullscreen presentParams.SwapEffect = SwapEffect.Discard; device = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, presentParams);And this is the code that loads the texture:  string file = "C:\\Documents and Settings\\Jens\\My Documents\\Visual Studio 2005\\Projects\\tclone\\playfield.bmp";    playfieldTexture = TextureLoader.FromFile(device, file, 800, 600, 24, 0, Microsoft.DirectX.Direct3D.Format.Unknown, Microsoft.DirectX.Direct3D.Pool.Default, Microsoft.DirectX.Direct3D.Filter.None,Microsoft.DirectX.Direct3D.Filter.None,0);And this is the game loop in the Main function  // game loop  while (win.Created)  { // render d3d win win.Render(); // let windows do message processing Application.DoEvents();  }Sorry for such a huge post, but would really appreciate to understand what is happening (even though it seems as I fixed it).   
  This is mostly speculation as I'm more of an unmanaged DX programmer...The following line:Sprite background = new Sprite(device);Is that going to be creating a new sprite object every frame? Presumably to be GC'd at some unknown point in the future...If so, it could be that the GC'er isn't catching up fast enough and there are a load of them hanging around in memory still.. Your example of the using block could well be forcing the scope of the object more tightl, hence it gets destroyed quicker.Have you tried running against the debug runtimes (with max output) to see if they give you a better idea of what it doesn't like?hthJack   