You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some product code we've seen a steady memory leak from one of our modules. I've narrowed the cause down to calls to JSON.parse() where the string provided is invalid json and causes the function to throw an Error.
Below, I've provided a simple recreate which when I run on the Chrome debugger, puts about 18 MB on the heap which doesn't seem to ever get GCed. It sounds much like the issue already reported in #33266 but this I understand was resolved in node 12.18.2.
Version: 12.18.3, 14.9.0 (NOT recreatable on 10.18.1)
Platform: Windows 10 (64-bit)
Subsystem:
What steps will reproduce the bug?
Run the following code - ideally under a debugger to allow inspection of the heap.
'use strict'
function test () {
for (let i = 0; i < 100000; i++) {
try {
JSON.parse('not valid json')
} catch (e) {
// Do nothing
}
}
}
test()
console.log('done')
In the heapdump I see thousands of these entries all retained by Global handles
How often does it reproduce? Is there a required condition?
It will happen every time you run the sample code provided
What is the expected behavior?
Garbage does not accumulate on the heap
What do you see instead?
Additional information
The text was updated successfully, but these errors were encountered:
lpinca
added
the
memory
Issues and PRs related to the memory management or memory footprint.
label
Sep 4, 2020
That sounds surprisingly similar to #33266, including the contents on the snapshot. If you let the code run indefinitely, does it crash for lack of space? Is it reproducible on previous v12 versions as well? Does it also happen on other platforms or is it happening only on Windows?
Possible recurrence of #33266
In some product code we've seen a steady memory leak from one of our modules. I've narrowed the cause down to calls to
JSON.parse()
where the string provided is invalid json and causes the function to throw an Error.Below, I've provided a simple recreate which when I run on the Chrome debugger, puts about 18 MB on the heap which doesn't seem to ever get GCed. It sounds much like the issue already reported in #33266 but this I understand was resolved in node
12.18.2
.12.18.3
,14.9.0
(NOT recreatable on10.18.1
)What steps will reproduce the bug?
Run the following code - ideally under a debugger to allow inspection of the heap.
In the heapdump I see thousands of these entries all retained by
Global handles
How often does it reproduce? Is there a required condition?
It will happen every time you run the sample code provided
What is the expected behavior?
Garbage does not accumulate on the heap
What do you see instead?
Additional information
The text was updated successfully, but these errors were encountered: