简体   繁体   English

在哪里可以阅读有关C ++中的内存结构的更多信息?

[英]Where can I read more about memory structure in C++?

I came across this presentation while browsing SO some time ago, and it relates performance to specific memory allocation decisions. 一段时间前,我在浏览SO时遇到了这个演示 ,它把性能与特定的内存分配决策相关联。 The author has some interesting diagrams that show how various objects are allocated by a C++ program, and goes on to optimise the program by making some changes in the code. 作者有一些有趣的图,这些图显示了C ++程序如何分配各种对象,并通过对代码进行一些更改来继续优化程序。 His diagrams make sense in their own context, but I'd like to know more about how to draw my own. 他的图表在它们自己的上下文中很有意义,但是我想更多地了解如何绘制自己的图表。

Where can I learn more about how C++ allocates objects in memory? 在哪里可以了解有关C ++如何在内存中分配对象的更多信息? I would like to know how various structures (arrays, pointers, ints, etc...) are placed when I write a program, in detail. 我想详细了解在编写程序时如何放置各种结构(数组,指针,整数等)。 Related to this are pre-caching techniques such as _dcbt, which sound interesting as well. 与此相关的是诸如_dcbt之类的预缓存技术,这听起来也很有趣。

You should have no problem finding any number of sites with information on C++ memory allocation. 您可以毫无问题地找到任何包含有关C ++内存分配信息的站点。 Here is a small sample from a quick Google search: 这是Google快速搜索的一小部分示例:

Here are a couple of books that might be of interest to you as well: 以下是您可能也会感兴趣的几本书:

Note that C++ says very little about how object are allocated in memeory. 请注意,C ++很少说明内存中对象的分配方式。 All the implementation details are left to individual compilers vendors to work out for themselves. 所有实现细节都留给各个编译器供应商自己解决。

So, while many techniques are common, none is guaranteed to be what is actaully used in your program. 因此,尽管有许多常见的技术,但不能保证它们绝对是您程序中实际使用的技术。

I recommand you the ultimate learning book of the C++ language: 我向您推荐C ++语言的终极学习书:

C++ Programming Language, by Bjarne Stroustrup, the father of C++ language C ++编程语言,C ++语言之父Bjarne Stroustrup撰写

http://www.amazon.com/Programming-Language-3rd-Bjarne-Stroustrup/dp/0201889544 http://www.amazon.com/Programming-Language-3rd-Bjarne-Stroustrup/dp/0201889544

Doug Lea has page up describing the implementation of malloc. Doug Lea的页面向上描述了malloc的实现。 It is an old article but I think most of its is still relevant. 这是一篇老文章,但我认为大多数文章仍然有意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM