memory usage of byte[] ?

John Rose John.Rose at Sun.COM
Sun Jul 6 22:46:27 PDT 2008


Actually, it's a long-standing bug that primitive arrays use memmove  
for array copy.

I'm working on a change set where we will use  
Copy::conjoint_memory_atomic instead, which has the correct semantics.
   http://webrev.invokedynamic.info/jrose/6711911/src/share/vm/oops/ 
typeArrayKlass.cpp.udiff.html

See:
   http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/file/tip/src/ 
share/vm/utilities/copy.cpp

-- John

On Jul 6, 2008, at 9:48 PM, Peter B. Kessler wrote:

> In addition to being rigorous about aligning things, we are also
> careful not to use calls like memcpy(3C), which is spec'd to copy
> by bytes, so one can see word-tearing if you are watching the
> destination while someone is memcpy'ing into it: e.g., an array
> of object references.  That was _no_ fun to debug.




More information about the hotspot-dev mailing list