Hi,
I am running openwrt on vm with base memory 256MB (on actual device it will be 64MB).
I downloaded and installed Nodejs using following command.
opkg update
opkg install node
Here is my expressJs based server code.
var express = require('express');
var app = express();
app.get('/',function(req,res){
res.json({"hello":"world"});
});
app.listen('8081',
function(){
console.log('app is now running on 8081');
})
node index.js to run the program
Output of top command
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
1 0 root S 13348 5% 0% /sbin/procd
1159 1087 root S 3064 1% 0% udhcpc -p /var/run/udhcpc-eth1.pid -s
633 2 root SW 0 0% 0% [kworker/0:2]
**3236 1323 root S 583m 238% 0% node index.js**
1087 1 root S 15432 6% 0% /sbin/netifd
1205 1 root S 15280 6% 0% /usr/sbin/uhttpd -f -h /www -r LEDE -
1042 1 root S 13232 5% 0% /sbin/rpcd
1112 1 root S 11224 4% 0% /usr/sbin/odhcpd
852 1 root S 8984 4% 0% /sbin/ubusd
1033 1 root S 7040 3% 0% /sbin/logd -S 64
1394 1365 root R 3076 1% 0% top
1323 1319 root S 3072 1% 0% -ash
854 1 root S 3068 1% 0% /bin/ash --login
1365 1361 root S 3068 1% 0% -ash
1248 1 root S 3064 1% 0% /usr/sbin/ntpd -n -N -S /usr/sbin/ntp
1361 1170 root S 3000 1% 0% /usr/sbin/dropbear -F -P /var/run/dro
1319 1170 root S 3000 1% 0% /usr/sbin/dropbear -F -P /var/run/dro
1314 1 dnsmasq S 2940 1% 0% /usr/sbin/dnsmasq -C /var/etc/dnsmasq
1170 1 root S 2888 1% 0% /usr/sbin/dropbear -F -P /var/run/dro
7 2 root SW 0 0% 0% [rcu_sched]
how to reduce memory consumption?
Thanks in advance