Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note that Vec<T> is heap allocated. #22305

Merged
merged 1 commit into from
Feb 16, 2015
Merged

Conversation

steveklabnik
Copy link
Member

Fixes #20948

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -49,8 +49,8 @@ languages.

A *vector* is a dynamic or "growable" array, implemented as the standard
library type [`Vec<T>`](../std/vec/) (we'll talk about what the `<T>` means
later). Vectors are to arrays what `String` is to `&str`. You can create them
with the `vec!` macro:
later). Vectors always allocate their data on the heap. Vectors are to arrays
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vectors are to slices, strictly speaking.

@alexcrichton
Copy link
Member

@bors: r+ 6d2e3d4 rollup

@tomjakubowski
Copy link
Contributor

Just for the record, I'm going to note thestinger's objections to this terminology from #18226:

The documentation should be conveying the language semantics, not an inaccurate analogy of the implementation details. Rust never makes use of the dss section (aka the heap) by default as jemalloc prefers obtaining all memory via anonymous memory mappings. Stacks are dynamic allocations coming from the same operating system API as Box and Rc. It's all obtained via mmap and VirtualAlloc. The classical distinction between a static call stack and a dynamic heap doesn't really exist on modern operating systems since multi-threading means stacks are dynamic memory allocations.

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Feb 14, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Feb 15, 2015
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 15, 2015
@bors bors merged commit 6d2e3d4 into rust-lang:master Feb 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the book should mention the difference between vectors and arrays.
7 participants