Skip to content
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

Documentation: Use of chrono under MSVC can cause a large memory leak #273

Closed
SpareSimian opened this issue May 24, 2024 · 2 comments · Fixed by #274
Closed

Documentation: Use of chrono under MSVC can cause a large memory leak #273

SpareSimian opened this issue May 24, 2024 · 2 comments · Fixed by #274
Labels
documentation Improvements or additions to documentation

Comments

@SpareSimian
Copy link

FYI Using MySQL datetime support with STL and C++20 can result in a memory leak being reported under MSVC. The timezone database (tzdb) is initialized in a way that's not protected from the debugger's leak detector.

A workaround is offered here: microsoft/STL#2504

More on the problem here: microsoft/STL#2047

I put the workaround in my wxApp::OnExit handler and the leak no longer floods the debug output.

#ifdef _DEBUG
   // to prevent the tzdb allocations from being reported as memory leaks
   std::chrono::get_tzdb_list().~tzdb_list();
#endif
@anarthal
Copy link
Collaborator

So if I understood correctly, this is a problem in MSVC STL that won't get fixed at all, isn't it? What can we do in MySQL about it? Maybe add the info you provided to the documentation to guide other users encountering it?

@anarthal
Copy link
Collaborator

I just saw the issue title :)

@anarthal anarthal added the documentation Improvements or additions to documentation label May 24, 2024
anarthal added a commit that referenced this issue May 24, 2024
anarthal added a commit that referenced this issue May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants