using `array` is recommended as it is safer to release memory