-
What is the difference between a leak and a dangling pointer?
If you have trouble remembering the difference between a leak and a dangling pointer, this may help. Before either problems occurs, memory is created on the heap and the address of this memory block is assigned to a pointer. A leak occurs when the pointer gets deleted, leaving a block with no reference. In contrast, a dangling pointer occurs when the memory block is deallocated, leaving a pointer that points to deallocated memory. Both are shown in the following figure.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules