官术网_书友最值得收藏!

Let's start at the beginning

In Chapter 2, Variables, I briefly mentioned how data is stored within memory, and I said that non-compound types, such as i32, are stored on the stack, whereas, the likes of String, Vector<T>, types, and such are stored on the heap.

By default, Rust stores data on the stack, as it's incredibly fast. There are drawbacks though. The stack is limited in size and the allocation only lasts for the lifetime of the function.

The question is, how much memory does a function take?

主站蜘蛛池模板: 泸溪县| 洛南县| 西乌珠穆沁旗| 保定市| 延吉市| 留坝县| 肥东县| 舞阳县| 化州市| 清远市| 蛟河市| 桦南县| 安义县| 古田县| 南陵县| 兴和县| 宽城| 大兴区| 金沙县| 广州市| 镇巴县| 阳西县| 海门市| 陵川县| 鸡泽县| 阳朔县| 安徽省| 岐山县| 安丘市| 乌鲁木齐县| 尖扎县| 上蔡县| 枣强县| 澄城县| 金坛市| 维西| 兴和县| 义马市| 澄江县| 普洱| 永和县|