1

The garbage collection to recycle object that is no longer used is to deallocate heap memory? Does Memory leak represent no enough heap memory space for the program to run? So what we normally say "out of memory" refers to "out of run time memory" which is "heap memory"?

0

Garbage collection usually indeed refers to the heap memory.

Note that memory leaks and out of memory errors are not synonymous. A memory leak is a situation where some chunk of allocated memory (e.g., an object in a OO language) is no longer needed, but for some reason cannot be deallocated/collected (e.g., the programmer forgot to clear some reference to it).
You can have a memory leak that does not cause an out of memory error (if the leak is sufficiently small), and you can get such an error without having a memory leak (if you legitimately try to allocate more memory than's available to the process).

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.