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 ..
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
> 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 ?
=?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/>
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 ?
=?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.
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.