Memory Usage

Stack memory is used when possible, heap when required / requested.

A field in a struct does not necessarily mean another pointer dereference.

Java

class Inner { int value;   }
class Outer { Inner inner; }

public static void main(String[] ag) {
    var s = "hello";

    var outer = new Outer();
    outer.inner = new Inner();
    inner.value = 123;

    System.out.println(
        "" + outer.inner.value
    );
}

Rust

struct Inner { value: i32   }
struct Outer { inner: Inner }

fn main() {
    let mut s = String::new();
    s.push_str("hello");

    let outer = Outer {
        inner: Inner {
            value: 123
        }
    };

    println!("{}", outer.inner.value);
}