问题描述
我目前正在阅读一篇未发表的硕士论文报告,我将提供反馈意见。
I'm currently reading an unreleased master thesis report, that I'm going to give feedback on.
在报告中他们提到了本地C ++和托管C ++下的GC。我认为C ++没有任何标准的GC,我错了还是正确的? (他们没有提到Boehm-Demers-Weiser。)
In the report they mention GC under native C++ and managed C++. I thought C++ didn't have any standard GC, am I wrong or right? (They do not mention Boehm-Demers-Weiser.)
在某些情况下,它们有一些问题。
They have some problem getting it to work under some conditions. They create objects in one thread, and delete the pointer from another thread.
推荐答案
托管C ++(及其后续C ++ / CLI)当然对托管资源使用.NET垃圾收集(虽然原生资源不是垃圾收集的,必须像本机C ++一样手动管理)。
Managed C++ (and its successor C++/CLI) of course use .NET garbage collection for managed resources (though native resources are not garbage collected and have to be managed manually as in native C++).
Native C ++默认没有这样的东西(最接近的是智能指针,但它仍然是完全不同的),但这并不妨碍你编写自己的垃圾回收解决方案(或使用)。
Native C++ by default has no such thing (the closest thing to this are the smart pointers, but that's still something entirely different), but that doesn't prevent you from writing your own garbage collection solution (or using third party solution).
这篇关于C ++有垃圾收集器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!