Allocating resources causes E_OUTOFMEMORY error when there is enough memory [ FIXED ]

Started by
9 comments, last by Negs 17 years, 1 month ago
Hi I have been finding that resource creation has been giving me the E_OUTOFMEMORY error sporadically. I assume that since there appears to be a different error for Video Memory (D3DERR_OUTOFVIDEOMEMORY) that this must mean System Memory. The problem is that there is clearly enough system memory available. I am allocating only a few textures and a couple of very small index and vertex buffers. I am allocating textures with D3DXCreateTextureFromFile. The textures allocated are three 256 * 64 textures, a 512 * 512 texture and a pair of 256 * 256 textures. There are perhaps 8 small vertex and index buffers of less then 20 vertices or indices each. All of these resources are being allocated in the Managed Pool. As you can see, this is hardly enough to expect to fill up system memory. The system in question has 2 GB of system memory and 512 MB of graphics memory. Ironically the error comes up far less frequently on my laptop with only 512 MB of main memory and a 128 Meg graphics card. Looking into various D3D creation options I noticed D3DCREATE_DISABLE_DRIVER_MANAGEMENT which says "Direct3D calls will not fail for resource errors such as insufficient video memory." but I do not think it had any effect. It kind of seemed like it happened less often, but its of hard to tell. Is there anything I need to know about why this kind of error would be happening? Thanks Jonathan Rogers [Edited by - Negs on March 23, 2007 3:43:35 PM]
Advertisement
Are they bmp's, if so any on them white, if so then the problem is that if you create a white bmp and set its size then save it the next time you create a bmp a different one this the one you saved will resize it's image this happend to me
these bmp's are all mad with paint.

if not it may not be a memory error some other point pointing some were it else.
Quote:Original post by ankhd
Are they bmp's, if so any on them white, if so then the problem is that if you create a white bmp and set its size then save it the next time you create a bmp a different one this the one you saved will resize it's image this happend to me
these bmp's are all mad with paint.
What?
I was using PNG texture files so I tried switching to DDS files to see if there was some kind of buggy loader for PNGs, but it didn't work. I still get E_OUTOFMEMORY on arbitrary calls.

It happens on Vertex buffers as well, so it seems to be on any kind of resource.

I'm getting very frustrated here, so any help would be appreciated.
Quote:Original post by Negs
Ironically the error comes up far less frequently on my laptop with only 512 MB of main memory and a 128 Meg graphics card.


This sentence leads me to believe you are (somehow, probably unintentional) allocating resources out the wazoo. I can't really think of any other reason. Could there be a loop somewhere in your program causing it to allocate (but never release) resources?
Quote:Original post by Todo
Quote:Original post by Negs
Ironically the error comes up far less frequently on my laptop with only 512 MB of main memory and a 128 Meg graphics card.


This sentence leads me to believe you are (somehow, probably unintentional) allocating resources out the wazoo. I can't really think of any other reason. Could there be a loop somewhere in your program causing it to allocate (but never release) resources?


I don't see what about that sentence would make you think that. If anything the opposite is true. Presumably have less RAM would mean the OUTOFMEMORY errors would come up more frequently?

Looking at the RAM usage in the task manager shows that there is more then 1GB of memory free when the error occurs.
Quote:Original post by Negs
I don't see what about that sentence would make you think that. If anything the opposite is true. Presumably have less RAM would mean the OUTOFMEMORY errors would come up more frequently?


My apologies. The way that sentence was constructed made me think it was a random error (or better: a failure occurring at random times), and therefore caused by something like a memory leak.

"Ironically the error comes up far less frequently [...]"
The task manager is not necessarily useful for checking this kind of thing.

What does the D3D debug output say? Can you clarify what you mean by "arbitrary" (one particular call always fails, or one call fails but its not always the same call, etc?)
Quote:Original post by jpetrie
The task manager is not necessarily useful for checking this kind of thing.

What does the D3D debug output say? Can you clarify what you mean by "arbitrary" (one particular call always fails, or one call fails but its not always the same call, etc?)



I'm not sure where to get any extra output.

I'm using the V_RETURN macro around the call from the DXUT which triggers the trace popup box showing E_OUTOFMEMORY.

Its not one particular call that fails, it could be any resource creating call. And a call does not always fail. On the machine with 2GB of ram a call will fail perhaps 1/3rd of the time. The rest of the time it is fine.

On the laptop it almost never happens.
In that case, Todo's speculation is possible. You may allocating over and over and never releasing something. If the failure is non-deterministic, it suggests the allocation may be in a loop somewhere.

As I said, the task manager isn't necessarily the best place to look and see.

To enable extra debugging information, go the DirectX Control Panel (either in your Control Panels, or under Utilities in the DirectX SDK start menu entry), enable the debug DLL, and turn the output slider up.

The output will appear in Visual Studio's Output window. See if anything interesting shows up.

This topic is closed to new replies.

Advertisement