Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Every new system compiles its variable files again, which sys.monitoring coverage retains

Đang mở
#607 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@MaxGhenis đang làm issue này rồi.

Từ ngày 11/10/2026.

  • #608 của @MaxGhenis — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Start with TaxBenefitSystem.add_variables_from_file and coverage/sysmon.py to trace how variable files are compiled and how SysMonitor.code_objects retains code objects. The issue proposes compiling each file once per process and executing it in each system's own module; check that modules, classes, functions, and globals remain separate. Done means repeated system creation no longer accumulates code objects under sys.monitoring; the issue links pull request #608, which is already open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

TaxBenefitSystem.add_variables_from_file compiles each variable file again for every new system (spec.loader.exec_module), so every system gets new code objects for the same source.

Coverage's sys.monitoring core keeps every code object it has seen alive until the process exits, so that it can key its records by id(code) (SysMonitor.code_objects in coverage/sysmon.py). It is coverage's default on Python 3.14, and opt-in on 3.12 and 3.13 with COVERAGE_CORE=sysmon. Under it, every system a process builds is retained as code objects, whatever happens to the system.

Measured on policyengine-uk (Python 3.13, coverage 7.16.2, core 3.33.2), one property-test file run serially: each Simulation left about 2,500 code objects and 3.6 MB of traced heap behind; with the C tracer or no coverage, memory stayed flat. On CI this grew four pytest-xdist workers to 15.3 of a runner's 15.6 GiB (PolicyEngine/policyengine-uk#2330).

A file's code object doesn't depend on the system that runs it. Compiling each file once per process and running that code object in each system's own module keeps every system's modules, classes, functions and globals separate, and removes the retention. It also saves the unmarshalling: building a UK system took 0.180 s of CPU instead of 0.289 s (median of 8, no coverage).

This is separate from #520 (the modules left in sys.modules), which this doesn't change.

Ngôn ngữ chính
Python
Star
22
Fork
30
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine-core

Tất cả issue của PolicyEngine/policyengine-core

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.