# Memory Usage - node-red-contrib-os 0.2.1

**URL:** <https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549>\
**Category:** General\
**Created:** [21 December 2022 19:54 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549 "2022-12-21T19:54:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manikandan](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Manikandan](https://discourse.nodered.org/u/Manikandan)\
**Post date:** [21 December 2022 19:54 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/1 "2022-12-21T19:54:24Z")

</div>

Hi ,  
I am new to node-red and JS.  
In my project i am using the below mentioned CPU

```auto
Architecture: armv7l
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Model: 4
Model name: ARMv7 Processor rev 4 (v7l)
CPU max MHz: 1200.0000
CPU min MHz: 600.0000
BogoMIPS: 76.80
Flags: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

```

To monitor the memory usage, I am using memory node from 'node-red-contrib-os 0.2.1',  
I have implemented this logic on three different project. all these project are same as other.  
I was wondering the response from each of these h/w on this memory usage are different and unable to match the result of this node result with the 'top' command result.

 ![2022-12-21_19h26_16](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a8c4ba0e3821c6d44533df46de1b24eb8681f753.jpeg)

Note : All the three device has a same node version [node-red-contrib-os 0.2.1]

Please do refer the attachment and please advise which one of them are showing the right memory usage ?  
Is there any configuration to be done on the OS to meet the node response with the Top command ?

Best Regards,  
Mani

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 December 2022 21:19 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/2 "2022-12-21T21:19:13Z")

</div>

If you are confident that the images you have posted really do relate to the `top` results shown, then the only conclusion I can come to is that the node does not work as one would expect.

Edit, If you install freemem and compare with that, what do you see?

---

<div class="post-metadata">

**Author:** ![Manikandan](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Manikandan](https://discourse.nodered.org/u/Manikandan)\
**Post date:** [22 December 2022 10:42 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/3 "2022-12-22T10:42:50Z")

</div>

Hi Colin,  
Thanks for responding to my query.  
Yes the image is right, not sure why the node are working properly.  
Can you Please provide more info on the 'freemem' installation ?  
Is it a flow, which I need to install ? or it's a command like 'free -h'

Best Regards,  
Mani

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 December 2022 10:55 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/4 "2022-12-22T10:55:59Z")

</div>

> [@Manikandan](#):
>
> Can you Please provide more info on the 'freemem' installation

It is a command, but I see it is not available on Pi os, so ignore that.  
Does `free` agree with top? I can only suggest posting an issue on the node's github page so the author can comment.

---

<div class="post-metadata">

**Author:** ![Manikandan](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Manikandan](https://discourse.nodered.org/u/Manikandan)\
**Post date:** [22 December 2022 12:28 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/5 "2022-12-22T12:28:10Z")

</div>

Hi Colin,

Thanks for helping me out again, Yes it's a misbehave on the node.  
Please refer the below image.

 ![FreeMemory_node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/5/7567fd56c32f69a9ff9bb27015fc5426771f21f3.png)

Sure will update in the GitHub.

Best Regards,  
Mani

---

<div class="post-metadata">

**Author:** ![Ekristoffe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ekristoffe/32/11863_2.png) [@Ekristoffe](https://discourse.nodered.org/u/Ekristoffe)\
**Post date:** [3 January 2023 09:02 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/6 "2023-01-03T09:02:28Z")

</div>

Hello, in this node we are just using node js memory function …  
Unless you have a different node js version or found a problem in node js code base I don’t think there is any fix …

As said in GitHub:  
On this node we only use node-js vanilla command:

```auto
  let tmem = os.totalmem();
  let fmem = os.freemem();
  const pmem = parseFloat((100 - (fmem / tmem) * 100).toFixed(2));

```

with the payload as:

```auto
  msg.payload = {
      totalmem: tmem, 
      freemem: fmem, 
      memusage: pmem
  };

```

---

<div class="post-metadata">

**Author:** ![Manikandan](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Manikandan](https://discourse.nodered.org/u/Manikandan)\
**Post date:** [3 January 2023 12:34 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/7 "2023-01-03T12:34:18Z")

</div>

Thanks @Ekristoffe for your response, as this has been discussed in GitHub , I am happy to close this issue in node-red forum.

[GitHub Link](https://github.com/Argonne-National-Laboratory/node-red-contrib-os/issues/15)

Best Regards,  
Mani

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 January 2023 14:23 UTC](https://discourse.nodered.org/t/memory-usage-node-red-contrib-os-0-2-1/72549/8 "2023-01-03T14:23:29Z")

</div>


