Josh Posted January 23, 2013 Posted January 23, 2013 I found out about the CreateThread mem leak and am switching the code to use _beginthreadex instead. However, the function is not recognized in Visual Studio. I do have the code generation set to multi-threaded. Does anyone know why this would still be happening? Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted January 23, 2013 Author Posted January 23, 2013 Ah, I had to include <Process.h>. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Canardia Posted January 23, 2013 Posted January 23, 2013 I would use pthreads, because it's cross-platform. It's built-in in mingw64, but for VisualStudio it's a seperate download: http://sourceware.org/pthreads-win32/ Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
Josh Posted January 23, 2013 Author Posted January 23, 2013 It already uses pthreads for everything but Windows. What do they do, make a wrapper around the Windows thread functions? On Windows, you have three thread creation functions: CreateThread _beginthread _beginthreadex And I guess the first two produce memory leaks with C++. Fortunately, you can slip _beginthreadex in easily and if you designed your threads around CreateThread, it still works the same. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.