# Process object memoryUsage()

**URL:** <https://discourse.nodered.org/t/process-object-memoryusage/48193>\
**Category:** General\
**Created:** [8 July 2021 22:37 UTC](https://discourse.nodered.org/t/process-object-memoryusage/48193 "2021-07-08T22:37:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![namgk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/namgk/32/4050_2.png) [@namgk](https://discourse.nodered.org/u/namgk)\
**Post date:** [8 July 2021 22:37 UTC](https://discourse.nodered.org/t/process-object-memoryusage/48193/1 "2021-07-08T22:37:40Z")

</div>

Hi there,

I'd like to access the process object inside the function code, such as to know the memory usage of the runtime:

```auto
msg.payload = process.memoryUsage()

```

Is there a way to do this?

Thanks

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [8 July 2021 22:50 UTC](https://discourse.nodered.org/t/process-object-memoryusage/48193/2 "2021-07-08T22:50:59Z")

</div>

Hi @namgk,

If you are running Node red 1.3 or greater you can enable in your `settings.js` file the option to load additional modules (as is the node.js `process` module).

More info on this new `functionExternalModules` Node-red feature [here](https://nodered.org/docs/user-guide/writing-functions#using-the-functionexternalmodules-option)

Once you have that setup .. all you have to do is require the module and use it in the function with the command you have in your post.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64221e0c0a1c6ab6bb263ebe05d2817483d19015.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fd683f0d885a26a8fa6513f49a7148af4dba213e.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/1171e9f7f98c90ac1c38b6a00182090e55cc39c7.png)

Test Flow

```auto
[{"id":"8045d8233a0fa439","type":"function","z":"4895ea10b4ee9ead","name":"","func":"msg.payload = process.memoryUsage()\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"process","module":"process"}],"x":620,"y":620,"wires":[["43219ebdd7140cf2"]]},{"id":"5e2779f67bfafe2b","type":"inject","z":"4895ea10b4ee9ead","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":470,"y":620,"wires":[["8045d8233a0fa439"]]},{"id":"43219ebdd7140cf2","type":"debug","z":"4895ea10b4ee9ead","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":780,"y":620,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 July 2021 22:51 UTC](https://discourse.nodered.org/t/process-object-memoryusage/48193/3 "2021-07-22T22:51:28Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
