lib: reduce memory allocation for arrays
The current implementation disposes used empty arrays and creates a new array. This PR reuses used empty arrays instead of creating a new array. This patch would reduce memory allocation time for Array(2048)
.