I have this code that takes video frame data, create a series of in-memory video buffers, run a series of HLSL shaders and return the output frame data. It's working fine when running in x86 mode.
https://github.com/mysteryx93/AviSynthShader/blob/master/Src/D3D9RenderImpl.cpp
If I compile in x64, it still works, BUT I'm getting a memory usage of 2337MB instead of 1117MB in x86!!
What could be causing such an increase in memory usage? What takes a lot of memory is that the code runs 8 instances in parallel, so 8 DX9 engines get created and all the video buffers get created 8 times.
But getting MORE than double the memory usage in x64? Why
Here are some benchmarks to give a better idea. In this case, I disabled Multi-Threading so it's running a single instance.
x86
Frames processed: 154 (0 - 153)
FPS (min | max | average): 4.267 | 5.818 | 5.094
Memory usage (phys | virt): 171 | 228 MiB
Thread count: 26
CPU usage (average): 4%
x64
Frames processed: 160 (0 - 159)
FPS (min | max | average): 4.417 | 6.071 | 5.441
Memory usage (phys | virt): 333 | 381 MiB
Thread count: 26
CPU usage (average): 4%
In this case the memory usage isn't so drastic but still is a lot higher.