I have an application that creates a hashMap of size 1300. The value in the hash map is an object called employee Data and key is just a string - EmpName. The object has a list. Rest other fields in the object are either String or double. The list size in the object varies between 4 to 5000. I want to do a rough calculation of the memory consumption. Could you please help me with it? I also want to know how GC will free this memory.
I did some calculation: The other fields will consume around 512 bytes each I am not sure how to calculate the consumption of the list. The list contains all double value. Also I am not how much memory of the object will increase with different size of the list and how will it contribute the overall memory consumption.
This could be the answer you're looking for.
The objects will be Garbage-Collected once the list no longer references to the objects; i.e; when the object is removed from the list.