Hello, I ran into a problem using JSTypedArray and was wondering if you could give me some help.
I read through the blog here and figured it out it could not solve my problem, but wondering if you might have ran into the same problem. I used an ArrayBuffer to transfer large amount of data from js to C, but the result is sometimes wrong. When I set a value in js, the underlying memory is untouched. for example
let arr = ... // arr is a Uint8Array
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
arr[3] = 4;
console.log(arr[0], arr[1], arr[2], arr[3]); // 1 2 3 4
console.log('' + arr); // something other than 1,2,3,4
console.log(arr[0], arr[1], arr[2], arr[3]); // something other than 1 2 3 4
It happens randomly, cannot be reproduced every time. The key is that when I made a native call, such as passing the TypedArray object into a native function, or calling toString of the typed array, the array then acts normally. Even if the native function does nothing with the array (such as JSObjectGetTypedArrayBytesPtr).
I sincerely hope that you could give some guidance about how to avoid this bug, many thanks.
Hello, I ran into a problem using JSTypedArray and was wondering if you could give me some help.
I read through the blog here and figured it out it could not solve my problem, but wondering if you might have ran into the same problem. I used an
ArrayBufferto transfer large amount of data from js to C, but the result is sometimes wrong. When I set a value in js, the underlying memory is untouched. for exampleIt happens randomly, cannot be reproduced every time. The key is that when I made a native call, such as passing the TypedArray object into a native function, or calling
toStringof the typed array, the array then acts normally. Even if the native function does nothing with the array (such asJSObjectGetTypedArrayBytesPtr).I sincerely hope that you could give some guidance about how to avoid this bug, many thanks.