I am new to PB and I have a question about passing a (big) string to a procedure:
As far as I understood it, strings are not passed ByRef, so this means that a string is copied when it is passed to a procedure?
So if I have a big string and pass it to a procedure - maybe several times - then it will cost much memory since the string is copied...?
Code: Select all
;Pseudo code;
BigString = ReadBigtextfile_to_String() ;read 100MB textfile into string variable
MyProc1 (BigString) ;will this copy 100MB to MyProc1 ?
MyProc2 (BigString) ;will this copy again 100MB to MyProc2 ?
procedure myProc1 (MyString.s)
;do something with myString.s
endprocedure
procedure myProc2 (MyString.s)
;do something with myString.s
endprocedure
Thanks