-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak when calling current_zone() #650
Comments
What OS/platform? |
CentOS 7.3 NAME="CentOS Linux" CENTOS_MANTISBT_PROJECT="CentOS-7" |
Is it reproduceable in a small test such as: #include "date/tz.h"
int
main()
{
auto tz = date::current_zone();
} And what build settings are you using (e.g. |
Does it reproduce with this program? #include "date/tz.h"
int
main()
{
auto tz = date::locate_zone("Europe/Berlin");
} |
Reproduces in both cases and USE_OS_TZDB was not set when compiling the library (i.e. it will use a curl request to fetch the tzdb) |
I'm not currently able to reproduce this on my platform. Can you use this tool to locate the source line in tz.cpp where the leaked memory is allocated? |
It appears to be allocated in the curl_init function. I see the curl_deleter struct is passed to the destructor of the CURL object, but it seems to only call curl_easy_cleanup(...) in operator(). If I add a call to ::curl_global_cleanup() after that and recompile the library, I am able to call current_zone() without any memory leaks. |
Really nice detective work. I would not have found this. Would you like for me to just fix it, or would you like to submit a P/R? |
Created a P/R here - #652 |
Fixed by #652 |
=================================================================
==32643==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x568e50 in calloc (/build/sbhat/Laser/BT.BelvedereExchange/Tests/BT.BelvedereExchange.Tests+0x568e50)
#1 0x7fffe1767163 (/lib64/libnsspem.so+0x15163)
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x568e50 in calloc (/build/sbhat/Laser/BT.BelvedereExchange/Tests/BT.BelvedereExchange.Tests+0x568e50)
#1 0x7fffe8ef4773 (/lib64/libnss3.so+0x75773)
Getting the following output when compiling using -fsanitize=address when the date::current_zone() fn is called
The text was updated successfully, but these errors were encountered: