- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 89字
- 2021-07-02 23:07:25
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?
推薦閱讀
- 構建移動網站與APP:HTML 5移動開發入門與實戰(跨平臺移動開發叢書)
- Three.js開發指南:基于WebGL和HTML5在網頁上渲染3D圖形和動畫(原書第3版)
- UI智能化與前端智能化:工程技術、實現方法與編程思想
- The Data Visualization Workshop
- Mastering Android Game Development
- ASP.NET Core 2 Fundamentals
- Python High Performance Programming
- 微服務架構深度解析:原理、實踐與進階
- Swift 4從零到精通iOS開發
- OpenCV 3計算機視覺:Python語言實現(原書第2版)
- Java并發實現原理:JDK源碼剖析
- Kotlin語言實例精解
- 一覽眾山?。篈SP.NET Web開發修行實錄
- HTML5 Game Development by Example:Beginner's Guide(Second Edition)
- Cinder:Begin Creative Coding