I am not sure I understand this example. Calling a method to process some data is not the same as assigning some data to another variable (like the array).
These two are different operations with different purposes and rarely can be used as a valid approach to refactoring code.
Maybe it is better to explain how to free up used memory instead. Otherwise, please let me know what you are trying to achieve here.