I wrote a .NET 4.5 application that buffers colour, infrared, and depth data from a Kinect v2, performs some processing on it, and then dumps it to disk, in uncompressed form; the .NET application also starts ffmpeg as a subprocess and pipes colour data to it to be encoded as H.264.
Because I'm not using an SSD, the video data arrives quicker than I can write to disk. But that's ok, it's acceptable for me to discard video frames when I'm low on RAM. My only requirement is that whatever I keep be mostly contiguous 8- to 10-second chunks of video. So I have added some logic in my .NET 4.5 application to start discarding video frames when I don't have enough RAM to buffer contiguous 8 to 10 seconds of video (roughly 1.5 to 2 GB).
And, to prevent page thrashing, I have completely disabled paging files. This leaves me with a total of 16 GB physical RAM.
My problem is that even with that mechanism in place, sometimes my .NET application or the ffmpeg subprocess still get killed when Windows 8.1 freaks out about low RAM, because obviously my application is using the most RAM when it has a huge backlog of video data to write to disk. Is there a way to tell Windows that my processes are more important than others so that Windows would start killing other less important processes first?
CreateMemoryResourceNotification
which is a lot less hacky.