09-07-2014, 04:30 AM -
For what I have understand, the issue comes from a replacement of new by a macro in rpcs3\rpcs3\stdafx.h when Memory Leak from Virtual Studio is activated.
The new macro doesn't support the new placement from C++11.
But wsWidgets use the new placemend in one of its header rpcs3\wxWidgets\include\wx\any.h line 216 which is included indirectly in 3 files :
I have found a thread in stackoverflow which describe a similar issue : http://stackoverflow.com/questions/11284...riding-new
However the solution it suggests may not be relevant.
Because the placement new is in a template class. Thus I don't know which "new" will be used during template instantiation in compilation, whether the "new" at the time of including the header defining the template, or the "new" at the time of template instantiation (so at the first use of template for a given type in source code).
**Can't edit my previous post before it is validated, so I post a new one. Can a moderator merge it with my previous post please ? **
EDIT1 : As said darkf in #rpcs3
EDIT2 : The class template using the placement new is instantiated in the same header. So there is no issue if at the time header is included, new operator is from standard C++.
A solution may be to save the new operator before overriding it with macro a way similar to the <crtdbg.h> file. (And that is why we are forced to override new outside crtdbg.h).
So adding a #pragma push_macro("new" before #define new DBG_NEW in stdafx.h
Then each time a problematic header is used :
After test, it seems to work.
I don't know the exact process to submit a fix from a local git repository to rpcs3 repository.
EDIT3: Fix submitted.
The new macro doesn't support the new placement from C++11.
But wsWidgets use the new placemend in one of its header rpcs3\wxWidgets\include\wx\any.h line 216 which is included indirectly in 3 files :
- rpcs3\Utilities\rMsgBox.cpp
- rpcs3\Utilities\rPlatform.cpp
- rpcs3\rpcs3\Crypto\unpkg.cpp
I have found a thread in stackoverflow which describe a similar issue : http://stackoverflow.com/questions/11284...riding-new
However the solution it suggests may not be relevant.
Because the placement new is in a template class. Thus I don't know which "new" will be used during template instantiation in compilation, whether the "new" at the time of including the header defining the template, or the "new" at the time of template instantiation (so at the first use of template for a given type in source code).
**Can't edit my previous post before it is validated, so I post a new one. Can a moderator merge it with my previous post please ? **
EDIT1 : As said darkf in #rpcs3
Quote:<darkf> placement new isn't C++11 afaikSo the new placement is not from C++11, it is quite old according to Wikipedia, but also rarely used.
<darkf> it's ancient
EDIT2 : The class template using the placement new is instantiated in the same header. So there is no issue if at the time header is included, new operator is from standard C++.
A solution may be to save the new operator before overriding it with macro a way similar to the <crtdbg.h> file. (And that is why we are forced to override new outside crtdbg.h).
So adding a #pragma push_macro("new" before #define new DBG_NEW in stdafx.h
Then each time a problematic header is used :
- include a macro to use the usual new with #pragma pop_macro("new",
- include the problematic header,
- include a new macro to redefine back the #define new DBG_NEW.
After test, it seems to work.
I don't know the exact process to submit a fix from a local git repository to rpcs3 repository.
EDIT3: Fix submitted.