Null-terminated Unicode strings in java.io on Windows

Clemens Eisserer linuxhippy at gmail.com
Fri Jan 25 19:29:44 UTC 2008


Hi there,

> This is getting a bit hostile for no reason....  Thinking about
> alignment gives an interesting solution.
>
> 1) Strings are not null-terminated
> 2) For most strings the alignment gives the VM room to terminate in
> place when GetStringChars is called
> 3) Copy strings that can't be terminated in place.

However GetStringChars() as far as I know always returns a copy
because hotspot does not support pinning (or at least I think so) - at
least for the moving GCs. So if one byte more is allocated or not on
the JNI side should not make much difference even if its never needed.

lg Clemens



More information about the core-libs-dev mailing list