Is there any method to compute actual size of LinkedList in bytes?
Suppose I have this List:
final LinkedList<String> strings = new LinkedList<>();
final SecureRandom random = new SecureRandom();
for (int i = 0; i < 600; i++) {
    final String e = new BigInteger(130, random).toString(32);
    strings.add(e);
}
How to calculate how many bytes in heap takes this LinkedList. Not just this 600 Strings, but all links and other meta-data of LinkedList
I ended up with the proposed method using Runtime.getRuntime().
Generating strings with the method mentioned above ( each String with length 32 ) give me this values in bytes:
Length      Size in bytes       L/S
---         ---                 ---
5           0                   0
10          0                   0
25          102.4036458333      0.244131932966                                  
50          102.4036458333      0.488263865931                                  
125         0                   0      
250         102.4036458333      2.44131932966                                  
625         614.41796875        1.01722285445                                    
1250        1843.2291666667     0.678157671659                         
3125        5632.1041666667     0.5548547945                         
6250        11162.2265625       0.55992413028                           
15625       500.9817708333      31.1887595711                          
31250       29318.5390625       1.06587848506                           
78125       30802.51171875      2.53631913895                          
156250      117437.975260417    1.33048955973                           
390625      84691.7486979167    4.61231472966                           
781250      125415.6875         6.22928451435                             
1953125     309488.9921875      6.31080603609 
3906250     509038.018229167    7.67378832251                                      

 
     
    