Commit 21fb9dc
authored
The gc_stats struct contains ring buffers of gc_generation_stats
entries (11 young + 3×2 old on default builds). Embedding it inline
in _gc_runtime_state, which is itself inline in PyInterpreterState,
pushed fields like _gil.locked and threads.head to offsets beyond
what out-of-process profilers and debuggers can reasonably read in
a single buffer (e.g. offset 9384 for _gil.locked vs an 8 KiB read
buffer).
Heap-allocate generation_stats via PyMem_RawCalloc in _PyGC_Init and
free it in _PyGC_Fini. This shrinks PyInterpreterState by ~1.6 KiB
and keeps the GIL, thread-list, and other frequently-inspected fields
at stable, low offsets.
1 parent b1d2d98 commit 21fb9dc
File tree
4 files changed
+24
-10
lines changed- Include/internal
- Modules
- Python
4 files changed
+24
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
352 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
180 | 185 | | |
181 | 186 | | |
182 | 187 | | |
| |||
1398 | 1403 | | |
1399 | 1404 | | |
1400 | 1405 | | |
1401 | | - | |
| 1406 | + | |
1402 | 1407 | | |
1403 | 1408 | | |
1404 | 1409 | | |
1405 | 1410 | | |
1406 | 1411 | | |
1407 | | - | |
| 1412 | + | |
1408 | 1413 | | |
1409 | 1414 | | |
1410 | 1415 | | |
| |||
1415 | 1420 | | |
1416 | 1421 | | |
1417 | 1422 | | |
1418 | | - | |
| 1423 | + | |
1419 | 1424 | | |
1420 | 1425 | | |
1421 | 1426 | | |
1422 | 1427 | | |
1423 | | - | |
| 1428 | + | |
1424 | 1429 | | |
1425 | 1430 | | |
1426 | 1431 | | |
| |||
2299 | 2304 | | |
2300 | 2305 | | |
2301 | 2306 | | |
| 2307 | + | |
| 2308 | + | |
2302 | 2309 | | |
2303 | 2310 | | |
2304 | 2311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1698 | 1698 | | |
1699 | 1699 | | |
1700 | 1700 | | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
1701 | 1706 | | |
1702 | 1707 | | |
1703 | 1708 | | |
| |||
2387 | 2392 | | |
2388 | 2393 | | |
2389 | 2394 | | |
2390 | | - | |
| 2395 | + | |
2391 | 2396 | | |
2392 | 2397 | | |
2393 | 2398 | | |
2394 | 2399 | | |
2395 | | - | |
| 2400 | + | |
2396 | 2401 | | |
2397 | 2402 | | |
2398 | 2403 | | |
| |||
2831 | 2836 | | |
2832 | 2837 | | |
2833 | 2838 | | |
| 2839 | + | |
| 2840 | + | |
2834 | 2841 | | |
2835 | 2842 | | |
2836 | 2843 | | |
| |||
0 commit comments