VM_Magic.setMemoryWord( copyBuffer.add(copyBufferLen - 4), 0 );
VM_Magic.setMemoryInt( copyBuffer.add(copyBufferLen - 4), 0 );
  private static VM_Address GetStringUTFChars(int envJREF, int objJREF, VM_Address isCopyAddress) {    if (traceJNI) VM.sysWrite("JNI called: GetStringUTFChars  \n");    VM_JNIEnvironment env;    try {      //    VM.sysWrite("GetStringUTFChars\n");      // retrieve the real String object from the side table      env = VM_Thread.getCurrentThread().getJNIEnv();      String str =  (String) env.getJNIRef(objJREF);      byte[] utfcontents = VM_UTF8Convert.toUTF8(str);      int len = utfcontents.length;      int copyBufferLen = (len + 4) & ~3; // need extra at end for storing terminator      // and end at word boundary       // alloc non moving buffer in C heap for string contents as utf8 array      // alloc extra byte for C null terminator      VM_Address copyBuffer = VM_Address.fromInt(VM.sysCall1(VM_BootRecord.the_boot_record.sysMallocIP, copyBufferLen));      if(copyBuffer.isZero()) {        env.recordException(new OutOfMemoryError());        return VM_Address.zero();      }      // store word of 0 at end, before the copy, to set C null terminator      VM_Magic.setMemoryWord( copyBuffer.add(copyBufferLen - 4), 0 );      VM_Memory.memcopy( copyBuffer, VM_Magic.objectAsAddress(utfcontents), len );      // set callers isCopy boolean to true, if it's a valid address      if (!isCopyAddress.isZero()) {        int temp = VM_Magic.getMemoryWord(isCopyAddress);        if (LittleEndian) {          VM_Magic.setMemoryWord(isCopyAddress, ((temp & 0xffffff00) | 0x00000001));        } else {          VM_Magic.setMemoryWord(isCopyAddress, ((temp & 0x00ffffff) | 0x01000000));        }      }      return copyBuffer;    } catch (Throwable unexpected) {      env = VM_Thread.getCurrentThread().getJNIEnv();      env.recordException(unexpected);      return VM_Address.zero();    }  }