You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is that as soon as the ArrayBufferView is created, the contents are copied to the ArrayBuffer on the js side and the View is no longer used.
exportconstfloatVectorToFloatArray=(wasmModule: MainModule,vec: VectorFloat32,enhancementFunc: (n: number)=>number=(n)=>n,): Float32Array=>{constpointer=wasmModule.vf32_ptr(vec);constsize=vec.size();// buffer is ArrayBufferView of WASM Memoryconstbuffer=newFloat32Array(wasmModule.HEAPF32.buffer,pointer,size);// copiedBuffer is referencing js side new ArrayBuffer instanceconstcopiedBuffer=buffer.map(enhancementFunc);returncopiedBuffer;};
The problem starts when you save the ArrayBufferView as a member of the class as is or as a member of an object, and you need to check for invalidation, but I don't see any such cases in the code.
I apologize for the confusion. You can close this issue once you've read it.
The text was updated successfully, but these errors were encountered:
The problem starts when you save the ArrayBufferView as a member of the class as is or as a member of an object, and you need to check for invalidation, but I don't see any such cases in the code.
I understand.
I'm planning to provide lower level API from core package, because there are some overhead of buffer copies in babylon.js integration (and will other package too).
At that time, it is important to check wheather the ArrayBuffer's pointer is correct or not, I think.
Context: https://x.com/noname20310/status/1862416380278317407
I've check the potential WASM memory view invalidation bug.
The conclusion is that there are no bugs in the code.
https://github.com/drumath2237/spz-loader/blob/main/packages/core/lib/spz-wasm/cppBufferUtil.ts#L18
The reason is that as soon as the ArrayBufferView is created, the contents are copied to the ArrayBuffer on the js side and the View is no longer used.
The problem starts when you save the ArrayBufferView as a member of the class as is or as a member of an object, and you need to check for invalidation, but I don't see any such cases in the code.
I apologize for the confusion. You can close this issue once you've read it.
The text was updated successfully, but these errors were encountered: