Trading firms can restart their software to fix the memory leaks.
Well, why did they have to restart if they never made any further allocations? This does not add up.
Just because you "preallocate" it doesn't mean that you don't implement a poor man's allocator inside the preallocated buffer.
I buy all the groceries I need from now until the end of time. That's not realistically achievable, from any perspective.
Allocating all the memory you need for a day is realistically achievable. Allocating all the memory you need until the end of time is not realistically achievable.
Still sounds like a leak to me.
It's a perfectly fine way of engineering a system.
There's also a variant of this that's been used on missiles - basically, you put enough RAM on the weapon to guarantee it'll hit its target or run out of fuel before running out of memory.
(Yes, talking about Erlang/OTP here.)
I once was tracking a white whale of a memory leak. Along the way I was able to optimize memory usage of the leaked objects. So I got to the point where I thought maybe the leak was caused by simultaneous read, update, and delete operations on a single key, but by then I'd improved memory usage such that weekly, rather than nightly restarts were needed. The futures markets at the time were 24/7 but with a maintenance period on the weekends, so my boss just told me to leave it and let the restarts garbage collect.
That's not a good argument. If there were more openings for that kind of position, more people would apply, and average remunerations would get lower.
The real problem is that this would effectively distribute wealth (and access to wealth) more widely, and the ruling classes can't have that as a matter of principle.
These days, there is a trend towards opening hours getting longer (eg [1]).
But there is still value to limited hours. Off the top of my head:
1. Liquidity gets concentrated. If there is a fixed amount of end-user demand (inflows into pension funds, oil production to hedge), then shorter hours means sort of 'denser' trading, which in turn means more quantity on the books, tighter prices, and better efficiency.
2. Trading is still done under human direction, or at least under human supervision, so shorter hours are less demanding on staffing. It's possible to run a productive soybean trading desk with two people at the moment. You'd need six people if trading was round the clock, and those people aren't cheap. Or else desks don't trade the whole day, and they miss out on opportunities, and other participants get less competition, and so worse efficiency.
3. Closing the market gives participants time to do various kinds of admin related to trading. Options markets close earlier than their corresponding futures markets, so that options market makers can get their position cleanly hedged. Bond markets close before repo desk traders go to the pub, so that bond trades can get financed.
[1] https://www.eurex.com/resource/blob/2845114/ae56de359f7a578e...