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

memory leak in a loop. #18367

Closed
manyuan opened this issue Jan 25, 2018 · 1 comment
Closed

memory leak in a loop. #18367

manyuan opened this issue Jan 25, 2018 · 1 comment
Labels
console Issues and PRs related to the console subsystem. duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@manyuan
Copy link

manyuan commented Jan 25, 2018

  • Version:v6.10.0
  • Platform:linux x86_64 ubuntu 16.04
  • Subsystem:

code:

while(true){
console.log(new Buffer("asdfasdfas"))
}

when run a few minute,program exit with error:

<--- Last few GCs --->

267659 ms: Mark-sweep 1376.8 (1434.7) -> 1376.8 (1434.7) MB, 1661.6 / 0.0 ms [allocation failure] [GC in old space requested].
269309 ms: Mark-sweep 1376.8 (1434.7) -> 1376.8 (1434.7) MB, 1650.0 / 0.0 ms [allocation failure] [GC in old space requested].
270967 ms: Mark-sweep 1376.8 (1434.7) -> 1376.7 (1403.7) MB, 1657.7 / 0.0 ms [last resort gc].
272617 ms: Mark-sweep 1376.7 (1403.7) -> 1376.7 (1403.7) MB, 1649.9 / 0.0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3378f3acfb51
1: nextTick [internal/process/next_tick.js:~134] [pc=0x36d27cb9206f] (this=0x2152b3c9b239 <a process with map 0x1594f1511671>,callback=0x87e0b825ac9 <JS Function afterWrite (SharedFunctionInfo 0x2152b3c52979)>)
2: arguments adaptor frame: 5->1
3: onwrite(aka onwrite) [_stream_writable.js:~356] [pc=0x36d27cb7c8dd] (this=0x3378f3a04381 ,stream=0x87e0b8435a1 <a WriteStream w...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x10983ec [node]
3: v8::Utils::ReportApiFailure(char const*, char const*) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
7: 0x36d27ca079a7

@bnoordhuis
Copy link
Member

Duplicate of many similar reports. Working as expected, console.log() is asynchronous.

@bnoordhuis bnoordhuis added duplicate Issues and PRs that are duplicates of other issues or PRs. console Issues and PRs related to the console subsystem. labels Jan 25, 2018
addaleax added a commit to addaleax/node that referenced this issue Nov 29, 2019
Improve performance and reduce memory usage when a writable stream
is written to with the same callback (which is the most common case)
and when the write operation finishes synchronously (which is also
often the case).

                                                         confidence improvement accuracy (*)    (**)   (***)
    streams/writable-manywrites.js sync='no' n=2000000                  0.99 %       ±3.20%  ±4.28%  ±5.61%
    streams/writable-manywrites.js sync='yes' n=2000000        ***    710.69 %      ±19.65% ±26.47% ±35.09%

Refs: nodejs#18013
Refs: nodejs#18367
addaleax added a commit that referenced this issue Dec 1, 2019
Improve performance and reduce memory usage when a writable stream
is written to with the same callback (which is the most common case)
and when the write operation finishes synchronously (which is also
often the case).

                                                         confidence improvement accuracy (*)    (**)   (***)
    streams/writable-manywrites.js sync='no' n=2000000                  0.99 %       ±3.20%  ±4.28%  ±5.61%
    streams/writable-manywrites.js sync='yes' n=2000000        ***    710.69 %      ±19.65% ±26.47% ±35.09%

Refs: #18013
Refs: #18367

PR-URL: #30710
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Dec 1, 2019
Improve performance and reduce memory usage when a writable stream
is written to with the same callback (which is the most common case)
and when the write operation finishes synchronously (which is also
often the case).

                                                         confidence improvement accuracy (*)    (**)   (***)
    streams/writable-manywrites.js sync='no' n=2000000                  0.99 %       ±3.20%  ±4.28%  ±5.61%
    streams/writable-manywrites.js sync='yes' n=2000000        ***    710.69 %      ±19.65% ±26.47% ±35.09%

Refs: #18013
Refs: #18367

PR-URL: #30710
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Dec 5, 2019
Improve performance and reduce memory usage when a writable stream
is written to with the same callback (which is the most common case)
and when the write operation finishes synchronously (which is also
often the case).

                                                         confidence improvement accuracy (*)    (**)   (***)
    streams/writable-manywrites.js sync='no' n=2000000                  0.99 %       ±3.20%  ±4.28%  ±5.61%
    streams/writable-manywrites.js sync='yes' n=2000000        ***    710.69 %      ±19.65% ±26.47% ±35.09%

Refs: #18013
Refs: #18367

PR-URL: #30710
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this issue Dec 17, 2019
Improve performance and reduce memory usage when a writable stream
is written to with the same callback (which is the most common case)
and when the write operation finishes synchronously (which is also
often the case).

                                                         confidence improvement accuracy (*)    (**)   (***)
    streams/writable-manywrites.js sync='no' n=2000000                  0.99 %       ±3.20%  ±4.28%  ±5.61%
    streams/writable-manywrites.js sync='yes' n=2000000        ***    710.69 %      ±19.65% ±26.47% ±35.09%

Refs: #18013
Refs: #18367

PR-URL: #30710
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
console Issues and PRs related to the console subsystem. duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

2 participants