Visual C++ thread safety of free and malloc? Visual C++ thread safety of free and malloc? windows windows

Visual C++ thread safety of free and malloc?


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.