What happens to memory after free()?

Your analogy is correct. The data in memory doesn’t disappear or anything like that; the values may indeed still be there after a free(), though attempting to read from freed memory is undefined behaviour.

Leave a Comment