2 pointsby gg5827 hours ago1 comment
  • DenisDolya5 hours ago
    Honestly, in many systems projects it is often simpler and safer to minimize or even avoid malloc entirely: rely more on stack, static buffers, or simple arenas. This usually leads to fewer bugs and more predictable behavior than building complex lifetime systems on top of the heap.
    • gg582an hour ago
      That is a valid point. When you are developing an application for an STM32, allocating memory on the heap is a bad idea. But if a programmer wants to make a high-performance back-end server in C, they should allocate unpredictable amounts of memory depending on a user's input(in many cases). This is not for Embedded/Hardware control; it aims for 'C Revival for High-level Development'. For a good example, many modern Rust applications do not statically fix memory areas; that is why Rust had to develop such a complex memory ownership system. In my personal opinion, with a bag of potato chips, you can do it better in C. Honestly, this does not have a proper memory tracker, so- yes. This does not have any advantages for now. However, I am planning to develop a memory lifetime tracker that can catch issues even before we run Valgrind or GDB. You can try to develop your own memory manager. This helped me to make my C-based web development framework safer through refactoring.

      :)