I'm not certain, but it looks to me like memoryjs is returning JavaScript numbers when getting pointers. 64bit pointers exceed the capacity of a JavaScript number. For that you need to use BigInt. I'm not sure, but I think this means memoryjs needs to somehow return BigInts when reading very large numbers and pointers.
Does this sounds correct? Am I wrong about part of this?