Visual C++ thread safety of free and malloc?
Does anyone know if free and malloc are threadsafe on visual C++ 2010?
I have having bizarre problems where memory is getting corrupted and im pretty much down to this being the only possiblity.
Does anyone know if the safety can be turned on and off and how?
Provided you're linking with thread-safe libraries and using the correct flags, yes, malloc
should be thread-safe.
If you think otherwise, you should post some code for us to examine.
I should mention that, in the vast majority of cases, it's never the libraries (which have been tested by uncounted millions of people). It's almost always your own code which, if you're thorough, has been tested by at most several dozen :-)
Not to say Microsoft (or any other large software house) doesn't ship bugs, just that they'd be discovered and fixed pretty damn quick.
链接地址: http://www.djcxy.com/p/50252.html