Bug #881
closedconfutils: memory leaks
0%
Description
Running valgrind --leak-check=yes .libs/lt-testlibrbd reveals several leaks in configuration and initialization. I'm working on the leaks in librados/librbd for #868. Valgrind summary is attached.
Files
Updated by Colin McCabe about 13 years ago
It would be best to replace those char* in md_config_t with std::string. With all the strdup antics going on, I'm sure there are some leaks. I doubt they're that big, though, since we just run init once and then we're done.
Updated by Colin McCabe about 13 years ago
Taking a closer look at this, it looks like there are some real errors in the ConfUtils class. The other stuff is just bogus warnings that happen because we never free the DoutStreambuf.
Updated by Sage Weil about 13 years ago
- Subject changed from memory leaks in initialization/configuration to confutils: memory leaks
Updated by Colin McCabe about 13 years ago
- Status changed from New to 4
I re-ran this on the latest code, and I saw a bunch of "potential leaks" related to allocating std::strings in the ConfFile. But these are all bogus because when the ConfFile is destroyed, those strings will all be freed.
I think valgrind is complaining about this because g_conf, a global, is creating a ConfFile. That ConfFile, and the memory inside it, won't be freed until g_conf is destroyed. But since g_conf has the special init_priority(103) attached to it, that happens after every other global has been destroyed. Perhaps valgrind's own analysis is running before that destructor is getting called?
Anyway, these are certainly not real memory leaks. If anyone has any idea how to get rid of these annoying warnings, it would be welcome. However, until then, this bug will have to be closed, or dormant, or something.
Updated by Colin McCabe about 13 years ago
- Status changed from 4 to Resolved
I don't see any obvious way to get valgrind to stop warning about these "potential leaks" which are not leaks at all. I think this is just something we're going to have to filter out. It only shows up when you run with --leak-check=full