Use DX9 with LARGEADDRESSAWARE

Started by
4 comments, last by MysteryX 8 years, 5 months ago

I want to allow using up to 4GB of memory when using DirectX9. Currently, when memory usage goes too high, I get this message:


access violation at 0x000E8AE5 in C:\WINDOWS\SYSTEM32\d3dx9_43.dll,
attempting to read from 0xE47DE9C0

I'm running my DLL via AVSMeter.exe which has the /LARGEADDRESSAWARE compilation flag.

Then in my code

https://github.com/mysteryx93/AviSynthShader/blob/master/Src/D3D9RenderImpl.cpp#L313

I replace

HR(D3DXGetShaderConstantTable((DWORD*)ShaderBuf, &Shader->ConstantTable));

with

HR(D3DXGetShaderConstantTableEx((DWORD*)ShaderBuf, D3DXCONSTTABLE_LARGEADDRESSAWARE, &Shader->ConstantTable));

I still get the same error message. What else do I need to change to make it work?

Advertisement

AFAIK when you turn on /LARGEADDRESSAWARE, you still have to use the "/3GB" boot option unless you're on a 64-bit OS.

But if you're on a 64-bit OS, build a 64-bit exe instead, which is the proper way to solve your problem.

I have a 64-bit OS, and this is an AviSynth plugin; AviSynth doesn't support 64-bit.

Nobody has an idea on this one? Basically, it *should* be working but isn't?

I'm using an EXE such as AvsMeter that has the 4GB patch, which loads the AVS script file and loads AviSynth.dll, which then loads my DLL, and the crash occurs within DirectX when memory usage gets too high.

If it *should* be working, any reason why it wouldn't?

There is one solution that can work for you.

Your problem obviously is that you're running out of virtual address space (past 2GB).

You can refactor your code so that you use expanded memory instead. The idea is to work on a small amount of virtual memory chunks while the physical memory backing that is much larger. So you can use for example 6GB of physical memory but only read 128 MBs using pointers at a time.

Read Myth: Without /3GB a single program can't allocate more than 2GB of virtual memory on how to do that.

Interesting technique. I don't think it's applicable in my case because I'm not allocating that memory myself. It gets eaten up when too many DX9 devices get created -- which I'm trying to reduce as well but that's a different topic.

This topic is closed to new replies.

Advertisement