I've been trying on and off to get gmp-wasm to work for me, and I'm getting a variety of weird behaviors. I suspect one of my bugs can be blamed on Kotlin/JS and another might be related to gmp-wasm. I've created a minimal repository that allows the bugs to be reproduced:
The README.md documents how to run the code and has the outputs. In short, I built a Kotlin BigInteger class that speaks directly to the mpz functions, and tries to manage gmp-wasm memory using FinalizationRegistry (so when the JavaScript wrapper object is garbage collected, it will tell gmp-wasm to free the corresponding mpz object).
I've been trying on and off to get
gmp-wasm
to work for me, and I'm getting a variety of weird behaviors. I suspect one of my bugs can be blamed on Kotlin/JS and another might be related togmp-wasm
. I've created a minimal repository that allows the bugs to be reproduced:https://github.com/danwallach/gmp-wasm-kotlin
The
README.md
documents how to run the code and has the outputs. In short, I built a KotlinBigInteger
class that speaks directly to thempz
functions, and tries to managegmp-wasm
memory usingFinalizationRegistry
(so when the JavaScript wrapper object is garbage collected, it will tellgmp-wasm
to free the correspondingmpz
object).I'd appreciate if you could take a look at this.