Visual C ++线程安全的free和malloc? [英] Visual C++ thread safety of free and malloc?

查看:104
本文介绍了Visual C ++线程安全的free和malloc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道free和malloc在Visual C ++ 2010上是否是线程安全的?

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?

推荐答案

提供的链接是线程安全库,并使用正确的标志,是的,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 :-)

并不是说Microsoft(或任何其他大型软件公司)不会发布错误,只是会很快发现并修复它们.

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.

这篇关于Visual C ++线程安全的free和malloc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆