It depends entirely on the implementation. Internally, all JS views end up being converted to a sparse view, but the sparese view tends to use more memory for each item and be slower to access than a non-sparse array.
For this reason, deleting a single value from a dense array is unlikely to free up any memory, but after removing a sufficient set of elements, the implementation is likely to be converted to a sparse representation to save memory in general.
Note: the object or value in the index you are deleting will not be deleted immediately - deleting simply removes the property slot from the object - the object / value will be deleted only during the passage of the GC, and only if there are no other links.
olliej
source share