3 ms·
Claiming that memory that's freed eventually isn't actually leaked may be factually true, but it isn't usefully true in all contexts. A more vague but more use
by mauvehaus 3y ago
Claiming that memory that's freed eventually isn't actually leaked may be factually true, but it isn't usefully true in all contexts.
A more vague but more useful definition of a memory leak is that if the memory consumption has a net increase over time, and that increase causes one or more problems, it's a leak.
Leaking a few kB or even MB in a short-lived client program isn't necessarily a leak in a practical sense.
Not freeing a few kB in a long-lived server process is a leak in practice if the process is going to crash or suffer degraded performance before they'll be eventually freed.
- bruce511 3y agoFirstly, I'd say a leak is a leak. A leak is not defined as "bad" - it's defined as allocated memory not bring freed. Whether the leak is "bad" or not depends on the context, but doesn't change the definition. >> A more vague but more useful definition of a memory leak is that if the memory consumption has a net increase over time, and that increase causes one or more problems, it's a leak. No. Its a problem. Caused by a leak. Your definition falls over for the case where a program is performing the task correctly, but on insufficient hardware (not enough ram) to complete the task.