S
Spirrwell
Guest
Hello there!
So recently I'd been working to make an application run with the C++17 standard. One of the projects is a DLL which in it allocates some threads using some wrapper classes. They're Win32 threads, not STL threads.
The debug build of the application has custom alloc and dealloc functions overriding new, malloc, and such which also uses the CRT debug library which is useful for tracking down leaks and such. If I switch the the DLL project to C++14, the debug version runs totally fine, it seems to do proper deallocation when delete is called on the thread wrapper class.
However, if I switch it to C++17, instead doing a standard free operation, it tries to do an aligned free and crashes.
The release build does not have this problem, and this issue seems to only exist in this one DLL regarding threads, and only with C++17.
The code is basically this:
SomeThreadClass *pMyThread = new SomeThreadClass;
and for deallocation
delete pMyThread;
Obviously there's more to it than that, but as far as allocation and deallocation, this is all there is to it.
When I have the project set for C++14, it seems under the "External Code" of the stack trace it seems to call some CRT free function, whereas with C++17 it seems to show scalar delete functions, something that looks like:
delete(void * block, std::align_val_t __formal) Line 32
Unfortunately, I can't really share any actual code, but there is something weird that is going on when switching from C++14 to C++17.
I'm running Visual Studio 2017 with the v141_xp toolset with Windows SDK version 7.0.
The only difference between it working and not working is the C++ language standard.
Any ideas as to what's going on?
Continue reading...
So recently I'd been working to make an application run with the C++17 standard. One of the projects is a DLL which in it allocates some threads using some wrapper classes. They're Win32 threads, not STL threads.
The debug build of the application has custom alloc and dealloc functions overriding new, malloc, and such which also uses the CRT debug library which is useful for tracking down leaks and such. If I switch the the DLL project to C++14, the debug version runs totally fine, it seems to do proper deallocation when delete is called on the thread wrapper class.
However, if I switch it to C++17, instead doing a standard free operation, it tries to do an aligned free and crashes.
The release build does not have this problem, and this issue seems to only exist in this one DLL regarding threads, and only with C++17.
The code is basically this:
SomeThreadClass *pMyThread = new SomeThreadClass;
and for deallocation
delete pMyThread;
Obviously there's more to it than that, but as far as allocation and deallocation, this is all there is to it.
When I have the project set for C++14, it seems under the "External Code" of the stack trace it seems to call some CRT free function, whereas with C++17 it seems to show scalar delete functions, something that looks like:
delete(void * block, std::align_val_t __formal) Line 32
Unfortunately, I can't really share any actual code, but there is something weird that is going on when switching from C++14 to C++17.
I'm running Visual Studio 2017 with the v141_xp toolset with Windows SDK version 7.0.
The only difference between it working and not working is the C++ language standard.
Any ideas as to what's going on?
Continue reading...