4 所有権 #4
Replies: 5 comments 15 replies
-
スタックとヒープ
スタック
ヒープ
関数実行コードが関数を呼び出すと、引数や関数のローカル変数がスタックに載り、実行が終わると取り除かれる 所有権が解決する問題
所有権の存在する理由はヒープデータの管理である |
Beta Was this translation helpful? Give feedback.
-
所有権規則所有権のルール:肝に命じておく
|
Beta Was this translation helpful? Give feedback.
-
2つの文字列型
let mut s = String::from("hello");
s.push_str(", world!"); // push_str()関数は、リテラルをStringに付け加える
println!("{}", s); // これは`hello, world!`と出力する
|
Beta Was this translation helpful? Give feedback.
-
参照と借用https://doc.rust-jp.rs/book-ja/ch04-02-references-and-borrowing.html |
Beta Was this translation helpful? Give feedback.
-
スライス型 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
参照先 : https://doc.rust-jp.rs/book-ja/ch04-01-what-is-ownership.html
所有権のおかげで、Rustはガベージコレクタ無しでメモリ安全な処理を実現している。
プログラムとメモリ
すべてのプログラムは、実行中にコンピュータのメモリの使用方法を管理する必要がある。
具体的なメモリ管理方法
各言語によって特色がある。
Beta Was this translation helpful? Give feedback.
All reactions