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

core: rename heapStats to memoryUsage #9986

Merged
merged 7 commits into from
Apr 12, 2021

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Apr 3, 2021

This PR aligns the name and output fields with node, since that's "standard" and there's nothing wrong with it.

The arrayBuffers field is 0, since we don't track ArrayBuffer allocation individually, but could with a custom allocator, but I think that's a separate issue.

Partially fixes #9980

Sample output

❯ ./target/debug/deno eval "console.log(Deno.core.memoryUsage())"
{ rss: 3363056, heapTotal: 4243456, heapUsed: 3561772, external: 0, arrayBuffers: 0 }

Questions

  1. Should we expose this directly on Deno and move it to stable ?

Change name and align output fields with node
core/bindings.rs Outdated Show resolved Hide resolved
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just Deno.memoryUsage() ?

@AaronO
Copy link
Contributor Author

AaronO commented Apr 4, 2021

Why not just Deno.memoryUsage() ?

Will do, if we're ok landing this as stable. Will add types and re-export it as Deno.memoryUsage() similar to how we re-export Deno.core.close()

@AaronO
Copy link
Contributor Author

AaronO commented Apr 6, 2021

@ry I've removed the arrayBuffers field and re-exported it as Deno.memoryUsage(), so this should be good to merge.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit bf99039 into denoland:main Apr 12, 2021
@AaronO AaronO deleted the deno-memory-usage branch April 12, 2021 08:48
@AaronO AaronO restored the deno-memory-usage branch April 12, 2021 08:48
@AaronO AaronO deleted the deno-memory-usage branch April 12, 2021 08:48
@danopia danopia mentioned this pull request May 9, 2021
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

Successfully merging this pull request may close these issues.

Deno equivalent of nodejs process.memoryUsage()?
4 participants