Based on background C, I have a very simple question: does a larger data type, such as a String array, skip a value, invokes something like a copy constructor in java.
Thus, this code will create a duplicate list in memory by copying the list in list2. Thus, the use of dual memory and processor.
String[] getList() { String[] list = new String... ... return list; } String [] list2 = getList();
Is my assumption correct? If so, is there an alternative, for example, passing pointers in C.
PS: if we allow the garbage collector to clean up additional memory, then this will be another set of processor use memory cleaning cycles that should not have been created in the first place.
source share