Re:They say that stocks go down during the day and up at night
by dahfizz on Tuesday February 07, 2023 @09:53AM
(#34693517)
Because the memory fills up. You pre-allocate a million orders, and send 800k orders a day, leaving only 200k free slots. You're going to run out mid day tomorrow if you don't restart.
[ Parent
| on HN ]
Re:They say that stocks go down during the day and up at night
by planede on Tuesday February 07, 2023 @10:36AM
(#34694133)
Ah, OK. But I would characterize this as an internal allocator that never deallocates. You might as well replace `malloc` and `free` to do the same, and just allocate within the program normally.
Just because you "preallocate" it doesn't mean that you don't implement a poor man's allocator inside the preallocated buffer.
Re:They say that stocks go down during the day and up at night
by dahfizz on Tuesday February 07, 2023 @11:43AM
(#34695058)
Sure, but calling malloc at runtime is slow and maintaining an allocator isn't very useful if you can just restart the app every night. YAGNI ;)
Re:They say that stocks go down during the day and up at night
by JamesSwift on Tuesday February 07, 2023 @10:47AM
(#34694283)
That just sounds like a memory leak with more words. Is the memory reclaimed/reclaimable? No? Ok then it leaked. If the system were able to reclaim the memory from the order, you wouldn't need to restart it. The memory arena strategy doesnt change that.
Re:They say that stocks go down during the day and up at night
by TeMPOraL on Wednesday February 08, 2023 @06:27PM
(#34717220)
It's still a fine strategy. One "formal" name for it I've heard is "null garbage collector". It may feel dirty, but it's pragmatic: if the program runs in cycles with well-defined starts and ends, restarting it reclaims all memory and brings the program to a well-known state.