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

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?

主站蜘蛛池模板: 金塔县| 涟水县| 勐海县| 金秀| 乌什县| 钟祥市| 徐闻县| 泰州市| 本溪市| 商都县| 阿图什市| 郯城县| 通榆县| 古蔺县| 洪湖市| 科尔| 鹤壁市| 融水| 晋江市| 泰州市| 武功县| 呼玛县| 阳西县| 乐亭县| 安福县| 大英县| 阳春市| 那坡县| 维西| 治多县| 志丹县| 出国| 萝北县| 浙江省| 玉田县| 庄浪县| 信阳市| 江陵县| 阳高县| 青阳县| 西华县|