About memory leak

Explanation:
Objects A, B, C are allocated into memory.
Then B is unused. The space of B is released.
Then D is coming, and is looking for a memory to store. B’s space is released, but is too small to D, so D find another place below C.
Later, because of the small space of B left, no variables can use it.
Then this memory is leaked.

If the application runs for a long time, there will have more and more space like B’s not be used anymore. The memory leak until outofmemory.

Need to know that: System memory = Physical memory + virtual memory

原文地址:https://www.cnblogs.com/backpacker/p/2271561.html