1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-26 17:23:01 +02:00

Remove memory management comparison (#1049)

This is a follow-up to #998 and the discussion in #1049. The
comparison page is now gone: like @randomPoison said, it feels
redundant and I also mostly skip over it when teaching the class.

I also took out some duplication in the Rust memory management page. I
would be up for simplifying the whole chapter down to one or two
slides as @djmitche suggests: that would leave us with more time for
covering ownership.
This commit is contained in:
Martin Geisler 2023-09-01 17:32:48 +02:00 committed by GitHub
parent c6af2a0d37
commit 55f6a8428e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 37 deletions

View File

@ -85,7 +85,6 @@
- [Scope-Based Memory Management](memory-management/scope-based.md)
- [Garbage Collection](memory-management/garbage-collection.md)
- [Rust Memory Management](memory-management/rust.md)
- [Comparison](memory-management/comparison.md)
- [Ownership](ownership.md)
- [Move Semantics](ownership/move-semantics.md)
- [Moved Strings in Rust](ownership/moved-strings-rust.md)

View File

@ -1,35 +0,0 @@
# Comparison
Here is a rough comparison of the memory management techniques.
## Pros of Different Memory Management Techniques
* Manual like C:
* No runtime overhead.
* Automatic like Java:
* Fully automatic.
* Safe and correct.
* Scope-based like C++:
* Partially automatic.
* No runtime overhead.
* Compiler-enforced scope-based like Rust:
* Enforced by compiler.
* No runtime overhead.
* Safe and correct.
## Cons of Different Memory Management Techniques
* Manual like C:
* Use-after-free.
* Double-frees.
* Memory leaks.
* Automatic like Java:
* Garbage collection pauses.
* Destructor delays.
* Scope-based like C++:
* Complex, opt-in by programmer (on C++).
* Circular references can lead to memory leaks
* Potential runtime overhead
* Compiler-enforced and scope-based like Rust:
* Some upfront complexity.
* Can reject valid programs.

View File

@ -3,7 +3,6 @@
Memory management in Rust is a mix:
* Safe and correct like Java, but without a garbage collector.
* Depending on which abstraction (or combination of abstractions) you choose, can be a single unique pointer, reference counted, or atomically reference counted.
* Scope-based like C++, but the compiler enforces full adherence.
* A Rust user can choose the right abstraction for the situation, some even have no cost at runtime like C.