2

I was watching pm2 monit.

My server process Mem coloured red.

enter image description here

I've checked my metrix enter image description here

I need help understanding heap usage.. Almost 100%? While heap size is only 30Mib ?

I allowed 2GB of memory to be used when running node.js.

Also, I checked the memory resources of the server, there was enough free memory.

What does this Usage mean?

And why is my mem painted red?.

5
  • Would you rather it used 6% of 2GB? A low heap size and a high utilization means it is running efficiently. A high heap size and low utilization means it's not releasing memory it isn't using.
    – tadman
    Commented Feb 4, 2023 at 1:46
  • @tadman UMMM!!!! so it should not be 1.8GB ? even though i allowed 2GB maximum they try to allocate more smaller size? for better optimize is this correct ?
    – MINJA KIM
    Commented Feb 4, 2023 at 1:50
  • 1
    You're limiting memory usage to 2GB. You're not forcing it to use that much out of the gate. In general, Node processes try and shed any allocations no longer needed, as in after garbage collection, to keep memory usage down.
    – tadman
    Commented Feb 4, 2023 at 1:52
  • 1
    @tadman Thank you! Maybe this question is too simplistic, but it was new territory for me.
    – MINJA KIM
    Commented Feb 4, 2023 at 1:55
  • If you're used to Java, where it stubbornly hangs on to as much memory as it can, Node's behaviour might seem unfamiliar.
    – tadman
    Commented Feb 4, 2023 at 2:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.