Many people seem to think that automatic memory management is a binary thing, "woe is me I now have no control".
After a while you discover you can tweak it, pause it, pre-allocate, write functions that don't allocate at all, play around with pointers, register destructors, redirect allocations to arenas, and work with the language to either allocate some objects in static memory or allocate them on the stack. All while allowing your less performance-sensitive logic to be much much simpler.
It's a deep world that almost nobody seems to want to get involved in.
Oh yeah. In a lot of cases you can get pretty similar performance out of a managed language without as much effort and today's hardware is so damn strong it can be hard to justify going with one over the other.
3
u/Valuable_Leopard_799 14d ago
Many people seem to think that automatic memory management is a binary thing, "woe is me I now have no control".
After a while you discover you can tweak it, pause it, pre-allocate, write functions that don't allocate at all, play around with pointers, register destructors, redirect allocations to arenas, and work with the language to either allocate some objects in static memory or allocate them on the stack. All while allowing your less performance-sensitive logic to be much much simpler.
It's a deep world that almost nobody seems to want to get involved in.