Re: D3DXCreateTexture returns E_OUTOFMEMORY

On Mar 1, 6:07 am, john <j...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
D3DXCreateTexture returns E_OUTOFMEMORY .

I run my program.
it consumes 700Mb system memory,when loading.
I calculated this using windows task manager [ctrl+alt+del].

total system mem is 1 Gyga Bytes.

so after loading my program,
almost 1 GBytes used, and very few available memory.

my program runs for a while.
and D3DXCreateTexture returns E_OUTOFMEMORY.

D3DXCreateTexture fails.
so I retried using

while( )
// until D3DXCreateTexture returns ok ..
call .. D3DXCreateTexture


but .. it never returns ok.

It won't. Once you fill a glass with water it
doesn't matter how much more you pour, the only
way to get more water in is to take some out.

so I can't create texture anymore.

of course, I just put another 1G memory card
the problem will be solved (70% ? possibility)

Unlikely. A 32-bit program gets 2GB user +
2GB system as its virtual environment. The
OS keeps track of how that maps to physical
memory and disk.

I want to know

why D3DXCreateTexture fails often ?
even when more memory can be allocated using virtual memory .
that is .. page file swaping ..

Ten to one you have a memory leak, the program
has allocated, used, and finished with a chunk
of memory, but failed to release it. Even if
it's just 4 bytes in one function call, the more
the function is called, the faster the program will
use up all the available memory.