napi-rs/memory-testing/tokio-future.js

23 lines
436 B
JavaScript
Raw Normal View History

2021-05-28 19:50:16 +09:00
const displayMemoryUsageFromNode = require('./util')
const initialMemoryUsage = process.memoryUsage()
const api = require(`./index.node`)
async function main() {
let i = 1
// eslint-disable-next-line no-constant-condition
while (true) {
await api.testAsync()
if (i % 100000 === 0) {
displayMemoryUsageFromNode(initialMemoryUsage)
}
i++
}
}
main().catch((e) => {
console.error(e)
process.exit(1)
})