# Implications of resize!

**URL:** <https://discourse.julialang.org/t/implications-of-resize/20237>\
**Category:** New to Julia\
**Created:** [January 29, 2019, 4:36pm UTC](https://discourse.julialang.org/t/implications-of-resize/20237 "2019-01-29T16:36:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [January 29, 2019, 4:36pm UTC](https://discourse.julialang.org/t/implications-of-resize/20237/1 "2019-01-29T16:36:46Z")

</div>

does the ability of resizing a `Vector` to a **longer length** implies that `Vector` is internally represented as something like a **linked list** , rather than **a contiguous piece of memory**???

```julia
julia> a = [1, 2, 3]
3-element Array{Int64,1}:
 1
 2
 3

julia> resize!(a, 4)
4-element Array{Int64,1}:
 1
 2
 3
 0

```

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [January 29, 2019, 4:40pm UTC](https://discourse.julialang.org/t/implications-of-resize/20237/2 "2019-01-29T16:40:14Z")

</div>

No, it’s contiguous memory. If you resize a vector grows the allocated memory block, reserving and exponentially growing block of memory so that append is amortized constant time.

---

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [January 30, 2019, 1:30am UTC](https://discourse.julialang.org/t/implications-of-resize/20237/3 "2019-01-30T01:30:47Z")

</div>

thanks.

`resize!()` actually calls `growend!()`, which in turn calls a `C` routine (that I could not inspect further).

so, the behavior of `growend!()` would be something like: if there’s available memory after the end, use it; or if there’s none, copy to a new piece of contiguous memory.

is it correct? thanks.
