Closed
Description
- Version: Node v4.4.4 / Node v6.1.0
- Platform: Linux 4.2.0-1-amd64 deps: update openssl to 1.0.1j #1 SMP Debian 4.2.6-3 (2015-12-06) x86_64 GNU/Linux
;(function loop () {
return Promise.resolve().then(loop)
})()
The code above increasingly consumes memory until it crashes with:
<--- Last few GCs --->
16059 ms: Scavenge 1406.1 (1457.9) -> 1406.1 (1457.9) MB, 19.4 / 0 ms (+ 2.6 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
18001 ms: Mark-sweep 1406.1 (1457.9) -> 1406.1 (1457.9) MB, 1941.5 / 0 ms (+ 3.7 ms in 2 steps since start of marking, biggest step 2.6 ms) [last resort gc].
19928 ms: Mark-sweep 1406.1 (1457.9) -> 1406.1 (1457.9) MB, 1927.5 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x30f9e32b4629 <JS Object>
1: PromiseSet(aka PromiseSet) [native promise.js:~38] [pc=0x21bc625235b] (this=0x30f9e32041b9 <undefined>,n=0x23be73509901 <a Promise with map 0x2d3fc3316dc9>,q=0,r=0x30f9e32041b9 <undefined>,t=0x23be73509961 <JS Array[0]>,u=0x23be73509941 <JS Array[0]>)
2: PromiseInit(aka PromiseInit) [native promise.js:~53] [pc=0x21bc624d6e9] (this=0x30f9e32041b9 <undefined>,n=0x23be73509901 <a Promis...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
With Bluebird, the used memory never goes above 30MB and the program does not crash:
global.Promise = require('bluebird')
;(function loop () {
return Promise.resolve().then(loop)
})()