Excessive memory consumption when handling large bundles without source maps
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- devtools
Hướng nghiên cứu
Bắt đầu trong source-map-support.js tại retrieveFile() và retrieveSourceMapURL(), sau đó lần theo đường dẫn bộ nhớ đệm của mapSourcePosition() được mô tả trong issue. Tái hiện việc tra cứu bằng một bundle lớn không có source map và xác minh rằng nội dung của nó không được giữ lại trong fileContentsCache sau lần tra cứu thất bại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment:
- Node.js with source-map-support
- several large JavaScript bundles (5–7 MB each)
- no source maps available for the bundles
Problem:
When an error is thrown in a large bundle, the source-map-support library unnecessarily retains the full file contents in memory. The file is loaded solely to check for a source map, but its contents are cached even after this one‑time operation. This results in excessive memory usage, especially problematic with multiple large bundles.
Steps to reproduce:
- An error is thrown in a bundle (e.g., index.js)
Error.prepareStackTrace()is called- The call chain proceeds as follows:
wrapCallSite()→mapSourcePosition()→retrieveSourceMap("index.js")→retrieveSourceMapURL("index.js")→retrieveFile("index.js") - The default
retrieveFilehandler loads the entire index.js file from disk and stores it in thefileContentsCache(source) retrieveSourceMapURL()fails to find a source map for the filemapSourcePosition()stores an empty source map in its internal cache (source)- The full contents of index.js remain in the
fileContentsCacheindefinitely, consuming memory
Expected behavior:
File contents should be used only once to check for the presence of a source map, and then either not cached at all or discarded immediately after the check. There is no need to retain large bundle files in memory after this operation.
Actual behavior:
Large bundle files (5–7 MB) are retained in the fileContentsCache after the first error, leading to unnecessary increase in memory footprint.
Proposed solution:
Avoid caching when no source map is found: skip storing file contents in fileContentsCache if the source map lookup fails.
- Ngôn ngữ chính
- JavaScript
- Star
- 2.2k
- Fork
- 221
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của evanw/node-source-map-support
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
evanw/node-source-map-support#343 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
evanw/node-source-map-support#337 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
evanw/node-source-map-support#333 ·
-
Provide esm versionĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
evanw/node-source-map-support#330 · 2 bình luận · 9 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
evanw/node-source-map-support#328 · 2 bình luận ·
Tất cả issue của evanw/node-source-map-support
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
[quality] Nothing keeps docs/skills/manifest.md in sync with docs/skills/*.mdCó thể đã có người làm @hivecommons-hive đã nhận hôm nay. Đang mởagent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
apache/rocketmq-dashboard#6610 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
githubnext/gh-aw-workshop#4535 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)Có thể đã có người làm @PINYOPATTANAWASANPORN đã nhận hôm nay. Đang mởarea: core Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
payloadcms/payload#18674 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày