Doubts about working with "ByReference" on arrays

Hi guys.

Can somebody help me understand if my assumption is correct on this, because on one example I find out something strange working with arrays and functions.

This is an example function, doesn´t matter what it does inside it, what is important is the parameter “actors”, that is an array let´s imagin, with 100.000 actors, so is a very heavy array and could be a performance problem if I don´t use properly.

I´m setting this parameter as a ByRef parameter:

201579-example+2.jpg

So, am I right on these assumptions?

  1. For an array is the same to have ByRef on/off, because you will get a reference to the array, but content of the array is allways BYREF, so if you change something in the content, it will be changed in the caller as well.

  2. If you turn on ByRef you could add an array element into Actors, and that array element will be modified in caller as well (like an output parameter) ← this is not currently happening.

  3. You could do the same as step 2, but instead of expect to change the source parameter, you could return again the same array in the return node… but does this mean that in a particular moment, I will get allocated in memory the same array but duplicated? (i´m trying to avoid this… array could be heavy)


I worked a lot in c# doing performance stuff improvements by sending heavy things byRef, so i´m trying to learn how this can be translate into gaming world.

Many thanks in advice!