Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discrepancy between 'pm2 monitor', 'top', and memwatch #31

Open
ktravelet opened this issue Jun 2, 2017 · 1 comment
Open

discrepancy between 'pm2 monitor', 'top', and memwatch #31

ktravelet opened this issue Jun 2, 2017 · 1 comment

Comments

@ktravelet
Copy link

Just curious why there seems to be such a big difference between the memory consumption reporting by the 2 different tools.

PM2: 64.313 MB
Top: 63840
Memwatch current_base: 19793416

Am I missing something here?

@joeytwiddle
Copy link

joeytwiddle commented Jun 19, 2017

I believe the process reserves more memory than the running app is actually using as data. There are various reasons why it does this. At a given point in time, some of this reserved memory might not actually be used by the app.

  • top (and presumably also pm2) are showing the amount of native memory that the process has reserved.

  • memwatch is showing the amount of memory currently used by the heap (all the data currently held by the app).

After a garbage collection, the memory reported by memwatch might drop significantly, although the native memory reserved for the process might not change at all.

Further reading (Sorry the links are for Java, but many of the concepts are the same.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants