We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to use ArrayType in ffi. but ArrayType arrays take large memory abnormally.
My code is below.
let uint8Array = ArrayType('uint8'); console.log("start") printHeapUsed(); let vectors = uint8Array(1); console.log("create uint8Array(1)") printHeapUsed() vectors = uint8Array(10); console.log("create uint8Array(10)") printHeapUsed() vectors = uint8Array(100); console.log("create uint8Array(100)") printHeapUsed() vectors = uint8Array(1000); console.log("create uint8Array(1000)") printHeapUsed() vectors = uint8Array(10000); console.log("create uint8Array(10000)") printHeapUsed() vectors = uint8Array(100000); console.log("create uint8Array(100000)") printHeapUsed() vectors = uint8Array(1000000); console.log("create uint8Array(1000000)") printHeapUsed() // print used heap function printHeapUsed() { let used = process.memoryUsage().heapUsed / 1024 / 1024; if (used < 1000) console.log(`heapUsed: ${Math.round(used * 100) / 100} MB\n`); else { used = used / 1024; console.log(`heapUsed: ${Math.round(used * 100) / 100} GB\n`); } }
and result in console..
start heapUsed: 4.53 MB create uint8Array(1) heapUsed: 4.56 MB create uint8Array(10) heapUsed: 4.57 MB create uint8Array(100) heapUsed: 4.62 MB create uint8Array(1000) heapUsed: 5.02 MB create uint8Array(10000) heapUsed: 8.85 MB create uint8Array(100000) heapUsed: 49.53 MB create uint8Array(1000000) heapUsed: 390.3 MB
ArrayType(ref.types.uint8).BYTES_PER_ELEMENT == 1 and I think the used heap is about 1MB with uint8Array(1000) but not.
Please tell me why. thanks.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I want to use ArrayType in ffi.
but ArrayType arrays take large memory abnormally.
My code is below.
and result in console..
ArrayType(ref.types.uint8).BYTES_PER_ELEMENT == 1
and I think the used heap is about 1MB with uint8Array(1000) but not.
Please tell me why. thanks.
The text was updated successfully, but these errors were encountered: