You've already forked comprehensive-rust
							
							
				mirror of
				https://github.com/google/comprehensive-rust.git
				synced 2025-10-31 08:37:45 +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:
		| @@ -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) | ||||
|   | ||||
| @@ -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. | ||||
| @@ -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. | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user