Hidden memory leaks

The system administrator said that memory leaks can be invisible. that is, all memory used by the application may not be displayed in the task manager or equivalent tool if the application runs a memory leak.

He seemed very sure of it. I am always sure that all memory leaks are displayed correctly (not in bytes, but that memory is constantly increasing until there is no more memory on the server) in tools like task manager (or process guide)?

Is this statement correct, and if so: what types of programs can leak memory this way?

Edit :

I'm not talking about seeing a leak, but the process is consuming more and more memory. According to him, this process will not consume more memory for certain memory leaks.

+4
source share
3 answers

A memory leak is a situation where a memory block is marked as busy, exists in the program memory, and there is no pointer variable in the program that stores the address if this block. The task manager and similar utilities show the total amount of occupied memory (plus overhead and fragmentation), and they have no idea about pointers - they cannot check the program memory.

That is why leaked memory and just occupied memory, the program stores pointers to indistinguishable for such utilities. So the memory leak is "silent" - in a secret way, so that the memory consumption of the program does not increase - it is impossible.

+4
source

First of all, it depends on how you determine the memory leak. Usually, I consider any case where memory has been allocated, but no pointers / links remain in it as a memory leak, and not just cases where the application constantly allocates memory without releasing it. (and you probably need a different definition if there is a GC)

This definition does not, it is impossible to see all memory leaks through the task manager, since the process may not return all the memory to the OS after its release by the program, so you will not necessarily see all positive or negative changes in memory usage.

However, any process that constantly copies memory really looks suspicious.

0
source

Depending on the compilation design, it is possible that memory is not actually allocated until it is first available. So for example this script:

while(malloc(50)); 

they say it causes a memory leak - because it just continues to assign memory until everything is accepted. However, if the memory is not actually allocated prior to its use, this will be an โ€œinvisible leakโ€, although I assume that this stretches the definition of leak;).

0
source

All Articles