| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f8884dd commit a6b2dfa
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,11 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | + // This value is used to prevent the nextTickQueue from becoming too | ||
| 4 | + // large and cause the process to run out of memory. When this value | ||
| 5 | + // is reached the nextTimeQueue array will be shortend (see tickDone | ||
| 6 | + // for details). | ||
| 7 | + const kMaxCallbacksUntilQueueIsShortened = 1e4; | ||
| 8 | + | ||
| 3 | 9 | exports.setup = setupNextTick; | |
| 4 | 10 | ||
| 5 | 11 | function setupNextTick() { | |
@@ -96,7 +102,7 @@ function setupNextTick() { | |||
| 96 | 102 | // callback invocation with small numbers of arguments to avoid the | |
| 97 | 103 | // performance hit associated with using `fn.apply()` | |
| 98 | 104 | _combinedTickCallback(args, callback); | |
| 99 | - if (1e4 < tickInfo[kIndex]) | ||
| 105 | + if (kMaxCallbacksUntilQueueIsShortened < tickInfo[kIndex]) | ||
| 100 | 106 | tickDone(); | |
| 101 | 107 | } | |
| 102 | 108 | tickDone(); | |
@@ -120,7 +126,7 @@ function setupNextTick() { | |||
| 120 | 126 | // callback invocation with small numbers of arguments to avoid the | |
| 121 | 127 | // performance hit associated with using `fn.apply()` | |
| 122 | 128 | _combinedTickCallback(args, callback); | |
| 123 | - if (1e4 < tickInfo[kIndex]) | ||
| 129 | + if (kMaxCallbacksUntilQueueIsShortened < tickInfo[kIndex]) | ||
| 124 | 130 | tickDone(); | |
| 125 | 131 | if (domain) | |
| 126 | 132 | domain.exit(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments