4 ms·
No, this still allocates a new string array per each line.split call. It's not really a problem with variables. The variables are likely on the stack anyways, b
by pkolaczk 3y ago
No, this still allocates a new string array per each line.split call. It's not really a problem with variables. The variables are likely on the stack anyways, but they only store pointers to data on the heap. If you call any function that allocates data on the heap you cannot get away with that by moving the variable declarations.