# Resize arrays in mutable structs

**URL:** <https://discourse.julialang.org/t/resize-arrays-in-mutable-structs/49701>\
**Category:** General Usage\
**Created:** [November 6, 2020, 7:24pm UTC](https://discourse.julialang.org/t/resize-arrays-in-mutable-structs/49701 "2020-11-06T19:24:48Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [November 7, 2020, 10:58pm UTC](https://discourse.julialang.org/t/resize-arrays-in-mutable-structs/49701/6 "2020-11-07T22:58:23Z")

</div>

There is absolutely no problem with resizing a `Vector` contained in a `struct` or `mutable struct` in Julia. It’s a perfectly normal and common thing to do. The only potential issue is if some other part of your program assumed that the exact memory address of that vector’s data would be constant forever, since resizing a `Vector` can cause its underlying data to be moved around. This isn’t a problem for purely Julia code, but it could be an issue when interacting with C/FORTRAN.

For example, if you passed that `Vector` as a `Ptr{Float64}` to your FORTRAN code, _and_ that code stored that address for later use, then you could end up in a situation where your FORTRAN code was still pointing to the old data address after the resize.

From what I can tell, it doesn’t sound like you’re doing that, so I don’t see any problem.

---

_[View the full topic](https://discourse.julialang.org/t/resize-arrays-in-mutable-structs/49701)._
