-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Potential memory leak in fs::WriteString #19356
Copy link
Copy link
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.memoryIssues and PRs related to the memory management or memory footprint.Issues and PRs related to the memory management or memory footprint.wipIssues and PRs that are still a work in progress.Issues and PRs that are still a work in progress.
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.memoryIssues and PRs related to the memory management or memory footprint.Issues and PRs related to the memory management or memory footprint.wipIssues and PRs that are still a work in progress.Issues and PRs that are still a work in progress.
I have not verified it yet, just discovered this when I went through the comments in node_file.cc to see if there is anything to update.
node/src/node_file.cc
Lines 1389 to 1391 in 040dd24
Looks like in the async case, if the buffer was copied instead of being moved (in the external string cases up there), then the
bufwill not get deleted after the request is done. This seems to be introduced when theFSReqWrap:: Ownershipwas removed in 4b9ba9b, and
ReleaseEarlywas no longer called upon destruction ofFSReqWrap.I am trying to come up with a fix, opening an issue in case this gets lost.