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

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?

主站蜘蛛池模板: 乐亭县| 抚顺县| 教育| 手机| 岫岩| 陵水| 河津市| 余姚市| 滦平县| 申扎县| 乐业县| 怀集县| 赤城县| 金山区| 观塘区| 阳山县| 靖宇县| 梅州市| 灵武市| 白玉县| 泰州市| 互助| 桑日县| 扶绥县| 二连浩特市| 涿鹿县| 苍梧县| 通化市| 陇南市| 尚志市| 罗山县| 蓬安县| 禄丰县| 康马县| 聂荣县| 大英县| 将乐县| 凌云县| 博爱县| 遂川县| 鹿邑县|