uci-utils-memory/examples/example.js

23 lines
394 B
JavaScript

import Memory from '../src/memory.js'
const mem = new Memory({db:0})
// let text
// mem.watch(console.log)
mem.watch()
setInterval(()=>
mem.emit('tick')
,5000)
mem.on('tick',()=> {
mem.log({msg:'testing'})
let text
for (let i = 0; i < 1000000; i++) {
text += 'a'
}
mem.text = text
console.log('memory that text is using', mem.sizeof(mem.text),mem.sizeof(text), 'M')
})