Why is Julia allocating when accessing these structs?

Yes, pass the data as parameters to the function. That’s the point.