C++内存管理的轶闻

C++内存管理的轶闻

C++中内存管理是一件比较麻烦的事情,因为需要手动进行内存的分配和释放,很容易出现内存泄漏的问题。

在C++ 11的标准制定过程中,Bjarne Stroustrup(C++之父)觉得Java的内存管理比较好,想要参考Java的方法改进C++。

当他给C++标准委员会提起这件事的时候,来自Microsoft和IBM等公司的代表马上不乐意了。代表们说,如果C++采用Java的内存模型,Java的运行速度至少会慢上一倍,你可不能这么对Java。

英文原文

Bjarne Stroustrup: We thought, at least I thought that Java had a pretty good memory model, so why don't we adopt that, and it'll save us a lot of work. So i mentioned this, and the representatives from various important groups such as Microsoft and IBM says, you can't do that, because if you adopt the Java memory model for C++, our Java implementations will slow down by at least a factor of two, and you just can't do that to Java.

视频链接

Core C++ 2021 :: Bjarne Stroustrup :: Thriving in a crowded and changing world: C++ 2006-2020

# C++ 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×