[ 
https://issues.apache.org/jira/browse/DERBY-3794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615978#action_12615978
 ] 

Knut Anders Hatlen commented on DERBY-3794:
-------------------------------------------

Copying my observations from DERBY-3731:

I used DTrace to check how much memory that was allocated in JDK 6 on
OpenSolaris 2008.05 and compared the results to what ClassSize would
estimate. I found these differences (assuming that refSize was
correctly set to 4 on 32-bit VMs and 8 on 64-bit VMs):

1) a better name for minObjectSize would be minArraySize, as it
attempts to estimate the fixed overhead for arrays

2) minObjectSize is set to 4*refSize (16 bytes on 32-bit, 32 bytes on
64-bit). The actual value is 3*refSize, but because of 8-byte word
boundaries the size of an empty array is refSize*3+4 == 4*refSize on
32-bit VMs (and the unused space can be exploited, so byte[0] and
byte[4] use the exact same number of bytes). On 64-bit VMs, 3*refSize
matches the word boundaries, so the correct value is 24 (and byte[1]
uses 8 more bytes than byte[0]).

3) booleanSize should be 1, not 4

4) charSize and shortSize should be 2, not 4

5) estimateBaseFromCoefficients() uses minObjectSize as the minimum
object size, whereas it actually is objectOverhead*refSize.

> Improve estimates in iapi.services.cache.ClassSize
> --------------------------------------------------
>
>                 Key: DERBY-3794
>                 URL: https://issues.apache.org/jira/browse/DERBY-3794
>             Project: Derby
>          Issue Type: Improvement
>          Components: Services
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> In a comment in DERBY-3731 I mentioned some discrepancies I found between the 
> estimated memory usage and the actual memory usage. We should try to improve 
> the estimates so that they match what is actually going to be used. The 
> actual memory usage may vary between different platforms, so it would be good 
> to check the actual memory usage on a range of platforms.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to