Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

D3DXCreateTexture returns E_OUTOFMEMORY

168 views
Skip to first unread message

john

unread,
Mar 1, 2007, 6:07:01 AM3/1/07
to

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 ..
Sleep(200);
call .. D3DXCreateTexture
}

but .. it never returns ok.

so I can't create texture anymore.

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

I want to know

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


Geoffrey Summerhayes

unread,
Mar 1, 2007, 11:52:44 AM3/1/07
to
On Mar 1, 6:07 am, john <j...@discussions.microsoft.com> 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 ..
> Sleep(200);
> 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.

---
Geoff

john

unread,
Mar 1, 2007, 7:17:00 PM3/1/07
to

thank you very much !

> 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.

I create textures [ about 900 textures but very small ]

I create textures , most of them [880/900] are 8*8, 16*16 pixel size.
very few [ 20/900 ] are 32*32, 64*64, 128*128, 256*256

but about 900 times.

and I do not release it.
I put texture pointers to queue using std::deque .

and reusing it.

that is .. check deque and if i found texture pointer available,
I use it. [ not newly creating texture]

but this can cause outofmemory errors ?


Richard [Microsoft Direct3D MVP]

unread,
Mar 1, 2007, 7:34:07 PM3/1/07
to
[Please do not mail me a copy of your followup]

=?Utf-8?B?am9obg==?= <jo...@discussions.microsoft.com> spake the secret code
<B7E8A04D-116B-418A...@microsoft.com> thusly:

>I create textures , most of them [880/900] are 8*8, 16*16 pixel size.
>very few [ 20/900 ] are 32*32, 64*64, 128*128, 256*256

You would be much better off creating a large texture and parceling it
out to the smaller images, particularly if these aren't mipmapped.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>

john

unread,
Mar 1, 2007, 8:33:03 PM3/1/07
to

> You would be much better off creating a large texture and parceling it
> out to the smaller images, particularly if these aren't mipmapped.

thanks. I will do it someday !

but now, I have to solve OUTOFMEMORY error in a week or so.

making small textures a lot can cause memory leak ?

Richard [Microsoft Direct3D MVP]

unread,
Mar 1, 2007, 9:25:15 PM3/1/07
to
[Please do not mail me a copy of your followup]

=?Utf-8?B?am9obg==?= <jo...@discussions.microsoft.com> spake the secret code

<3CF50921-3619-45C9...@microsoft.com> thusly:

>> You would be much better off creating a large texture and parceling it
>> out to the smaller images, particularly if these aren't mipmapped.
>
>thanks. I will do it someday !

Well, when you do it "someday" you will probably have solved your
problem.

Most memory allocation algorithms do the worst when you allocate lots
of little objects. You pay the most overhead that way.

john

unread,
Mar 2, 2007, 12:55:00 AM3/2/07
to

> Most memory allocation algorithms do the worst when you allocate lots
> of little objects. You pay the most overhead that way.

thanks.

is there any method that I can manage memory directly ?

and another question,

even in 900 times texture create calls,
it consumes only a few Mega Bytes , at most less than 10 Mbytes.'
because textures are very small [8*8 pixels].

even in small memory fragments,
maybe , I guess a lot of available memory still exists.

but D3DXCreateTexture returns OutOfMemory.

why this occurs ?

then, heap size is very small in my program ?

or I have already used many heap memory when loading other resources
like vertex buffer, other textures for objects and characters.
and general buffers like string arrays or others.

I use 1G system memory,
and my program use 700M when loading on initial loading
when I saw in windows task manager .

and I have created most textures and VB, IB with MANAGED POOL option.

thanks.


Simon Cussonet

unread,
Dec 6, 2007, 9:24:38 AM12/6/07
to
Hi Geoff!
I guess you mighthelp me to understand better what's happening to me with
"crash to desk" (CTD) errors in a game called Medieval Total War (MTW).
The game plays well, but after a while (a few turns) it starts CTDing, and
at last it crashes as soon as you load your saved game.
I was thinking of a "cumulative" bug and your sentence "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" seems particularly appropriate
to describe what happens...
Trying to reinstal the game, I noticed a error.log file more than 20Mo large,
full of this kind of error messages : C:\Med_Patch\Crusaders_TW\sound.
cpp(469) : DirectX call : E_OUTOFMEMORY
Failed to play 3D sound : CAVALRY_MARCH_HEAVY_SLOW_S
When I delete the text and save this file so reseting it to 0 byte, it works
well again... till next time the file is "full"!
So I'm wondering whether it is actually the writing procedures (and thus the
opening/closing operations of this huge log file) made by the game for the
errors in the log file which lead to CTD in my game, or the DirectX error
themselves.
If you have any idea of a solution, either to limit the number of DirectX
error messages or to "clean up" automatically the log file, or anything else,
I would be delighted.
Thank you for your lights!
Simon
PS : I am French and not a specialist computer, so I apologize if my
expression is a little bit awkward...

url:http://www.ureader.com/msg/14641586.aspx

0 new messages