How can I reclaim the memory used by an object and all of its data structures into my application memory without System.gc()
which only suggests and not necessarily perform memory check. This also includes methods like finalize
.
In other words, assume I have a HashMap
and I want all the data it stores to be deleted from the memory. I normally do clean this type of collections with clean
methods or attach it to null
but that doesn't seem to return the memory space to the application?
Edits:
Let us say the following:
TIntObjectHashMap<byte[]> map=new TIntObjectHashMap<byte[]>();
//fill the map with 20GB
map.clear();
//Or map=null;
Shouldn't the 20GB goes back free? That is the question.