yandex
loader

please wait

  • Arminder Gill Mar-14-2019 05:39:05 AM ( 2 months ago )

     

    This simple code makes app crash with out of memory:

     

    var buf;
    console.log(process.memoryUsage())
    for(i=0; i<10000000; i++){
        buf = Buffer.alloc(1024)
        buf.clear
        delete buf
        buf = null
    }
    console.log(process.memoryUsage())

    So how properly recycle the buffer so it can be reused? Not sure if clear or delete are appropriate methods but how then?

Please login

Similar Discussion

Recommended For You