3 ms·
The author's definition of a leak is somewhat unusual. If a memory is allocated and eventually freed it's not really a leak in the strict sense. That's why the
by kccqzy 3y ago
The author's definition of a leak is somewhat unusual. If a memory is allocated and eventually freed it's not really a leak in the strict sense. That's why the author is having so much trouble with typical tools like Valgrind or leak sanitizer: the definition of the leak is different!
I would approach this problem by using regular profiling. Collect a few memory profiles and see whether there's any suspiciously large chunk of memory not yet freed.
- none_to_remain 3y agoIt's just a leak from an internal allocator
- mauvehaus 3y agoClaiming 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.