Try googling for "realtime garbage collector": there's been a lot of work on this for at least a decade or two, which addresses precisely the problems you mention.
I personally never understood what the big deal is about freeing memory manually.
The really big deal is that if you ever free a single object/allocation while there's another reference to it, you've created a timebomb. This kind of problem is excruciatingly hard to debug when the memory gets reallocated.
The big deal is that if you do enough bookkeeping to guarantee that you never free referenced memory, and you have objects with nontrivial lifetimes, then you've spent a great deal of time writing a memory management system that's not as good as what's built into any modern language.
Try googling for "realtime garbage collector": there's been a lot of work on this for at least a decade or two, which addresses precisely the problems you mention.
The really big deal is that if you ever free a single object/allocation while there's another reference to it, you've created a timebomb. This kind of problem is excruciatingly hard to debug when the memory gets reallocated.
The big deal is that if you do enough bookkeeping to guarantee that you never free referenced memory, and you have objects with nontrivial lifetimes, then you've spent a great deal of time writing a memory management system that's not as good as what's built into any modern language.