[nodejs] Re: How to free memory after require(JSON) ?

2017-09-20 Thread Валерий Дубчак
Change on it: var jsonfile = require('jsonfile') var fs = require('fs') var files = fs.readdirSync('./path/'); files.forEach(filename => { var data = jsonfile.readFileSync('./path/' + filename); data = null; }); It is help. среда, 20 сентября 2017 г., 12:36:10 UTC+9 пользователь Валерий Дубчак

[nodejs] Re: How to free memory after require(JSON) ?

2017-09-20 Thread Andrey
On Wednesday, 20 September 2017 13:36:10 UTC+10, Валерий Дубчак wrote: > > Node version 8.5.0 > There are 100 JSON files of 8 mb each. > I read them in the node: > > var files = fs.readdirSync ('./ path /'); > > files.forEach (filename => { > > var data = require ('./ path /' + filename); > data

Re: [nodejs] How to free memory after require(JSON) ?

2017-09-20 Thread Joshua Holbrook
I suspect that your caching theory is a likely culprit. One approach is to sidestep the cache and use fs.readFileSync + JSON.parse. That kind of thing is pretty easy to hand-roll. Give it a shot and combine with your data = null dereferencing strategy and see if it helps? --Josh On Tue, Sep 19, 2

[nodejs] Re: How to free memory after require(JSON) ?

2017-09-20 Thread Murukesh Sadasivan
Can you do a simple fs.read instead of require('...')? require('...') is used for loading source files and might do some internal caching to prevent repeated loading. Cheers Murukesh On Wednesday, 20 September 2017 09:06:10 UTC+5:30, Валерий Дубчак wrote: > > Node version 8.5.0 > There are 10