By the way, your system probably reserves virtual memory for you instead of immediately allocate a region in RAM. That can be used if you don't know final size and reallocation is too slow for your purposes. You can just limit usage with some variable and extend it when needed.
At this point, I should've started with GPU-accelerated encoding and not compress everything on CPU. It's basically unacceptably slow, intense and unprofitable.
Started implementing XOR delta for my video compression and OH GOD. This technique reduced memory consumption dramatically. I'm so glad to finally see that the idea of compression wasn't wrong, after 2 weeks of development.
And the worst thing about that is that such larpers will take away jobs from those who don't generate 5 projects per month, but try to deeply understand how things work, actually think about the best solution and try to maintain quality of code.
Holy, my feed is full of posts about AI. I don't even know why. Tech twitter is people who don't actually work, who makes tens of posts every day, who larps about being very productive with their new *the best* AI model. Such a mass hysteria!
I still don't believe that the best way to lower memory consumption for compressed frames and samples in RAM I came up with is dynamic ring buffer. At least, after 8 hours of writing and testing this Frankenstein, I finally managed to make it work. Nighttime development is hell.
Fun fact: two competing real-time compression algorithms lz4 and zstandard are developed by the same person, and because of that their API are very similar and both so pleasant to use
Gravel bikes are insane. 60km is not something unusual for me, but this time I lost all my energy trying to keep up with them on my MTB. Should say that my bike is high-quality and quite light, meanwhile that gravel bike is very budget.
So every time you try to write big files, keep in mind that fwrite has a local buffer and doesn't actually write to file descriptor immediately. This knowledge will save you a lot of time debugging