Simply deleting an object does not automatically free up the memory allocated for it.
The concept of memory management is not directly related to the use of the delete
keyword in programming. This fact is explicitly mentioned in the reference material you are citing.
Both MyObject[idx]=null
and delete MyObject[idx]
have a similar impact on memory. If the object referenced by MyObject[idx]
is no longer being used anywhere else, the garbage collector will eventually clean up the memory space occupied by that object.
In most cases, there is no need to manually free up memory. Instead, focus on deleting properties or removing elements from arrays when they are no longer needed. This approach differs from explicitly releasing memory resources.