• jim3692@discuss.online
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    2 days ago

    An important detail that is missing here is how deallocation works.

    When an application tells the system that it no longer needs a chunk of memory, the system does not erase the data from that region. It instead allows other applications to take control of that chunk.

    Imagine it like renting a room, but you keep a copy of the key before checking out. You have supposedly left the room, but you still have access to it.

    In the software world, this is unintentional behavior. In the real world, it would look like you accidentally return to that room.

    Or, like you checkout, but your friend still has a key. Without knowing that you checked out, they return to take a bath. If a 3rd person knows about this miscommunication, they can rent that room, and steal your friend’s money during the bath.