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

Does console.log leak? #4280

Closed
tolmasky opened this issue Dec 14, 2015 · 3 comments
Closed

Does console.log leak? #4280

tolmasky opened this issue Dec 14, 2015 · 3 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@tolmasky
Copy link
Contributor

So, if I run the following program:

while (true)
    console.log("hello... there");

Within approximately 3 minutes or so node is consuming 1.5GB of memory. The behavior is of course saner if I pipe to /dev/null.

However, if I run the following program:

def hello():
    while True:
        print "hello world..."

hello()

Python stays at 3.3MB forever.

The reason I bring this up is that in our tests, we seem to have to be careful how often we log, since it seems to dramatically influence the memory consumption (and thus make memory tests untrustworthy).

This is in basically all versions of node (the above is 5.2, but were experiencing similar, perhaps worse, behavior in node 4 / 12/ 10 etc).

@fivdi
Copy link

fivdi commented Dec 14, 2015

No, it's not a leak. Everything is ok. See #2970 and #1741 for further info.

@cjihrig
Copy link
Contributor

cjihrig commented Dec 14, 2015

This is a known issue. You can read more in #3171 and #1741.

@cjihrig cjihrig closed this as completed Dec 14, 2015
@ChALkeR ChALkeR added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Dec 15, 2015
@abhinavsingi
Copy link

From #2970 (comment)

Short answer: console output is buffered and async. Your console is slower then the script, and the buffer isn't limited by anything except for the global memory limit. So, it fills up the buffer and dies.
More info at #1741.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

5 participants