zengqh / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

Out of memory occurs if I am using RenderTarget #420

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using SlimDX Nov2008.

Let's see a code:

for (int i = 0; i < 2000; i++)
{ 
// Create render target               
renderTarget = new Direct3D9.Texture(device, width, height, 1, 
Direct3D9.Usage.RenderTarget, format, 
Direct3D9.Pool.Default);                
depthSurface = Direct3D9.Surface.CreateDepthStencil(device, width, height, 
Direct3D9.Format.D24X8, Direct3D9.MultisampleType.None, 0, true);

// TODO: Here we'll place code later

// Dispose all data
renderTarget.Dispose();
depthSurface.Dispose();
}

This code works fine. But now we add several lines in TODO mark. The lines 
are:

device.DepthStencilSurface = depthSurface;
device.SetRenderTarget(0, renderTarget.GetSurfaceLevel(0));
device.BeginScene();
device.EndScene();

And now we see Out of memory exception.

This is very bad for me, I'm using RT very intensively.
Please, connect with me as soon as possible if you will know how to fix 
this trouble. daVinci@mail.ru

Original issue reported on code.google.com by telegram...@gmail.com on 28 Jan 2009 at 8:08

GoogleCodeExporter commented 9 years ago
Sorry guys, I had to dispose renderTarget.GetSurfaceLevel(). SlimDX is a nice 
API.

Original comment by telegram...@gmail.com on 28 Jan 2009 at 4:52

GoogleCodeExporter commented 9 years ago
This is related to the dread issue #359, unfortunately. :(

Original comment by josh.petrie on 28 Jan 2009 at 5:43

GoogleCodeExporter commented 9 years ago
Merging into #359.

Original comment by promit....@gmail.com on 29 Jan 2009 at 10:05

GoogleCodeExporter commented 9 years ago
Reopening to track against a unit test.

Original comment by josh.petrie on 1 Feb 2009 at 8:54

GoogleCodeExporter commented 9 years ago

Original comment by josh.petrie on 1 Feb 2009 at 8:54

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by josh.petrie on 1 Feb 2009 at 9:04