Finally I have a valid reason to learn about memory management. It was also hella weird when encountering it.

  • entwine
    link
    fedilink
    arrow-up
    2
    ·
    3 months ago

    being inserted automatically.

    Aka the entire point of RAII

    • resipsaloquitur@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      3 months ago

      The point of RAII is that a resource is allocated and freed in the same scope.

      You can free it with an explicit call to a destructor, an implicit call, or with memory allocated on the stack, just wait for the stack frame to be exited.