cpython/Modules
Pablo Galindo Salgado 572c780aa8
gh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads (#142137)
This PR implements frame caching in the RemoteUnwinder class to significantly reduce memory reads when profiling remote processes with deep call stacks.

When cache_frames=True, the unwinder stores the frame chain from each sample and reuses unchanged portions in subsequent samples. Since most profiling samples capture similar call stacks (especially the parent frames), this optimization avoids repeatedly reading the same frame data from the target process.

The implementation adds a last_profiled_frame field to the thread state that tracks where the previous sample stopped. On the next sample, if the current frame chain reaches this marker, the cached frames from that point onward are reused instead of being re-read from remote memory.

The sampling profiler now enables frame caching by default.
2025-12-06 22:37:34 +00:00
..
_ctypes Remove unreachable break statements in _ctypes_test.c (#140585) 2025-10-25 14:59:12 +00:00
_decimal gh-111389: replace deprecated occurrences of _PyHASH_* macros (#141236) 2025-11-09 15:14:08 +01:00
_hacl gh-140120: Refresh HACL* to fix an hmac memory leak (GH-140188) 2025-10-16 05:25:51 +00:00
_io gh-60107: Remove a copy from RawIOBase.read (#141532) 2025-11-20 17:37:04 +00:00
_multiprocessing gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
_remote_debugging gh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads (#142137) 2025-12-06 22:37:34 +00:00
_sqlite gh-140042: Removing unsafe call to sqlite3_shutdown (GH-141690) 2025-11-20 15:35:22 +01:00
_sre gh-116738: Fix thread-safety issue in re module for free threading (gh-141923) 2025-11-26 15:40:45 -05:00
_ssl gh-137583: Only lock the SSL context, not the SSL socket (GH-137588) 2025-08-10 14:47:11 +00:00
_testcapi gh-141780: Make PyModule_FromSlotsAndSpec enable GIL if needed (GH-141785) 2025-11-24 13:26:35 +01:00
_testinternalcapi gh-114203: skip locking if object is already locked by two-mutex critical section (#141476) 2025-11-14 23:17:59 +05:30
_testlimitedcapi gh-132657: add regression test for PySet_Contains with unhashable type (#141411) 2025-11-12 20:50:08 +05:30
_xxtestfuzz gh-131253: free-threaded build support for pystats (gh-137189) 2025-11-03 11:36:37 -08:00
_zstd gh-139877: Use PyBytesWriter in pycore_blocks_output_buffer.h (#139976) 2025-10-14 10:03:55 -07:00
cjkcodecs gh-101828: Fix jisx0213 codecs removing null characters (gh-139340) 2025-10-14 22:55:00 +09:00
clinic gh-48752: Add readline.get_pre_input_hook() function (#141586) 2025-12-05 13:18:54 +01:00
expat gh-139312: Update bundled libexpat to 2.7.3 (GH-139319) 2025-09-26 19:44:36 -07:00
_abc.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
_asynciomodule.c gh-141376: Rename _AsyncioDebug to _Py_AsyncioDebug (GH-141391) 2025-11-12 09:42:56 +01:00
_bisectmodule.c GH-135763: AC: Use `Py_ssize_t(allow_negative=False)` (#138394) 2025-09-02 21:29:05 +01:00
_bz2module.c gh-116738: Use PyMutex for bz2 module (gh-140555) 2025-10-27 09:52:30 -04:00
_codecsmodule.c gh-55531: Implement normalize_encoding in C (#136643) 2025-10-30 15:31:47 +01:00
_collectionsmodule.c gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) 2025-06-30 11:14:31 +00:00
_csv.c gh-116738: Make csv module thread-safe (gh-141365) 2025-11-21 11:22:31 -05:00
_curses_panel.c gh-116946: add Py_TPFLAGS_IMMUTABLETYPE to several internal types (#138582) 2025-09-11 09:56:20 +02:00
_cursesmodule.c gh-129813, PEP 782: Use PyBytesWriter in _curses (#138920) 2025-09-15 16:24:34 +02:00
_datetimemodule.c gh-139774: use relaxed atomics for datetime hashes (#139775) 2025-10-08 19:49:54 +05:30
_dbmmodule.c gh-116738: Add critical section to dbm/gdbm context manager (gh-140391) 2025-10-22 11:16:28 -04:00
_elementtree.c gh-140061: Use _PyObject_IsUniquelyReferenced() to check if objects are uniquely referenced (gh-140062) 2025-10-15 09:48:21 -04:00
_functoolsmodule.c GH-140590: Fix setstate for functools.partial C-module (GH-140671) 2025-10-28 10:28:32 +01:00
_gdbmmodule.c gh-116738: Add critical section to dbm/gdbm context manager (gh-140391) 2025-10-22 11:16:28 -04:00
_hashopenssl.c gh-129813, PEP 782: Use PyBytesWriter in _hashopenssl (#138922) 2025-09-15 18:41:43 +02:00
_heapqmodule.c Fix comments for heapq.siftup_max (#135359) 2025-07-03 15:21:41 +05:30
_interpchannelsmodule.c gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307) 2025-10-19 22:24:28 +03:00
_interpqueuesmodule.c gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307) 2025-10-19 22:24:28 +03:00
_interpreters_common.h gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134440) 2025-05-22 06:50:06 -06:00
_interpretersmodule.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
_json.c gh-137821: Improve Argument Clinic definitions in the `_json` module (#140780) 2025-10-30 10:32:08 +00:00
_localemodule.c gh-130567: Remove optimistic allocation in locale.strxfrm() (GH-137143) 2025-10-16 09:54:41 +02:00
_lsprof.c Remove internal _PyTime_AsLong() function (#141053) 2025-11-05 18:37:06 +01:00
_lzmamodule.c gh-116738: use PyMutex in lzma module (#140711) 2025-11-12 02:01:55 +05:30
_math.h gh-122681: remove m_atan2()/c_atan2() helpers (#122715) 2024-08-17 13:48:16 +05:30
_opcode.c gh-135755: Move SPECIAL_ constants to a private header (GH-135922) 2025-06-25 13:03:05 +02:00
_operator.c gh-131238: Add explicit includes to pycore headers (#131257) 2025-03-17 12:32:43 +01:00
_pickle.c gh-115952: Fix a potential virtual memory allocation denial of service in pickle (GH-119204) 2025-12-05 19:17:01 +02:00
_posixsubprocess.c gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141660) 2025-11-19 09:37:09 +02:00
_queuemodule.c gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) 2025-06-30 11:14:31 +00:00
_randommodule.c Fix a compiler warning in _randommodule.c (#141058) 2025-11-05 18:00:32 +00:00
_scproxy.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_ssl.c gh-141801: Use accessors for ASN1_STRING fields in libssl (GH-141802) 2025-11-22 09:17:45 -08:00
_ssl.h GH-103092: isolate _ssl (#104725) 2023-05-22 06:14:48 +05:30
_ssl_data_35.h gh-139573: Update OpenSSL in CI (GH-139577) 2025-10-04 19:43:17 -05:00
_ssl_data_111.h gh-131423: Update OpenSSL data to 3.4.1 on Linux (#131618) 2025-04-25 10:26:58 +02:00
_ssl_data_300.h gh-127330: Update for OpenSSL 3.4 & document+improve the update process (GH-127331) 2024-11-28 13:29:27 +01:00
_ssl_data_340.h gh-131423: Update OpenSSL data to 3.4.1 on Linux (#131618) 2025-04-25 10:26:58 +02:00
_stat.c gh-108765: fix comment about macro definitions in _stat.c post GH-108854 (#136027) 2025-06-27 15:15:11 +00:00
_statisticsmodule.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_struct.c gh-140260: fix data race in _struct module initialization with subinterpreters (#140909) 2025-11-13 16:31:31 +05:30
_suggestions.c gh-116738: Make _suggestions module thread-safe (gh-140321) 2025-10-22 09:14:48 +09:00
_sysconfig.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
_testbuffer.c gh-136300: Modify C tests to conform to PEP-737 (GH-136301) 2025-07-11 15:18:35 +02:00
_testcapi_feature_macros.inc gh-91325: Skip Stable ABI checks with Py_TRACE_REFS special build (GH-92046) 2024-01-29 16:45:31 +01:00
_testcapimodule.c GH-139914: Handle stack growth direction on HPPA (GH-140028) 2025-11-17 14:41:22 +01:00
_testclinic.c gh-111489: Remove _PyTuple_FromArray() alias (#139973) 2025-10-11 22:58:14 +02:00
_testclinic_limited.c gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
_testimportmultiple.c gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
_testinternalcapi.c gh-139109: A new tracing JIT compiler frontend for CPython (GH-140310) 2025-11-13 18:08:32 +00:00
_testlimitedcapi.c gh-111495: Add PyFile tests (#129449) 2025-01-30 18:05:32 +01:00
_testmultiphase.c gh-141780: Make PyModule_FromSlotsAndSpec enable GIL if needed (GH-141785) 2025-11-24 13:26:35 +01:00
_testsinglephase.c gh-140550: Initial implementation of PEP 793 – PyModExport (GH-140556) 2025-11-05 12:31:42 +01:00
_threadmodule.c GH-116946: revert eliminate the need for the GC in the _thread.lock and _thread.RLock (#141448) 2025-11-12 07:21:43 +00:00
_tkinter.c gh-124111: Fix TCL 9 thread detection (GH-128103) 2025-11-12 22:16:58 +00:00
_tracemalloc.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
_typesmodule.c gh-136492: Add FrameLocalsProxyType to types (GH-136546) 2025-07-20 20:49:00 +02:00
_typingmodule.c gh-105499: Merge typing.Union and types.UnionType (#105511) 2025-03-04 11:44:19 -08:00
_uuidmodule.c gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (#132901) 2025-05-26 10:56:31 +02:00
_weakref.c gh-120974: Make _asyncio._leave_task atomic in the free-threaded build (#122139) 2024-07-23 17:06:03 +00:00
_winapi.c gh-129813, PEP 782: Use PyBytesWriter in _winapi.PeekNamedPipe() (#138930) 2025-09-15 21:25:47 +01:00
_zoneinfo.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
addrinfo.h gh-114917: add support for AI_NUMERICSERV in getaddrinfo emulation (#114918) 2025-03-18 11:26:51 +01:00
arraymodule.c gh-140474: Fix memory leak in array.array (GH-140478) 2025-10-23 05:49:27 -04:00
atexitmodule.c gh-140080: Clear atexit callbacks when memory allocation fails during finalization (GH-140103) 2025-10-15 09:49:55 -04:00
binascii.c gh-129813, PEP 782: Use PyBytesWriter in binascii (#138825) 2025-09-13 18:25:16 +02:00
blake2module.c gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
cmathmodule.c gh-116738: Statically initialize special constants in cmath module (gh-142161) 2025-12-04 09:21:51 -05:00
config.c.in gh-128384: Use a context variable for warnings.catch_warnings (gh-130010) 2025-04-09 16:18:54 -07:00
errnomodule.c gh-126585: Add EHWPOISON error code (#126586) 2024-12-03 12:45:50 +00:00
faulthandler.c gh-137725: Convert faulthandler to Argument Clinic (#137726) 2025-08-16 15:16:04 +02:00
fcntlmodule.c gh-140615: Update docstrings in the fcntl module (GH-140619) 2025-11-08 12:17:59 +02:00
gc_weakref.txt GH-135552: Make the GC clear weakrefs later (GH-136189) 2025-08-07 16:32:17 -07:00
gcmodule.c GH-140638: Add a GC "candidates" stat (GH-141814) 2025-11-22 21:59:14 +00:00
getaddrinfo.c gh-114917: Fix typo in getaddrinfo emulation (#131413) 2025-03-18 14:31:13 +01:00
getbuildinfo.c gh-100388: Change undefined __DATE__ to the Unix epoch (#100389) 2025-03-03 14:59:46 +01:00
getnameinfo.c Replace K&R function declarations with ANSI declarations (#114818) 2025-03-11 13:06:36 +01:00
getpath.c GH-131296: Avoid invalid signed char comparison in getpath.c assertion (GH-131594) 2025-04-22 14:06:30 +01:00
getpath.py gh-120037: Disable user site packages when a ._pth file is used (GH-137428) 2025-08-19 21:28:28 +01:00
getpath_noop.c bpo-45582: Port getpath[p].c to Python (GH-29041) 2021-12-03 00:08:42 +00:00
grpmodule.c gh-116738: Make grp module thread-safe (#135434) 2025-07-14 11:18:41 -07:00
hashlib.h gh-131876: Revert "gh-131876: extract _hashlib helpers into a separate directory (#136995) (#137307) 2025-08-01 10:45:40 -07:00
hmacmodule.c gh-116946: remove unnecessary gc from immutable types (#139073) 2025-10-01 13:15:58 +05:30
itertoolsmodule.c gh-140061: Use _PyObject_IsUniquelyReferenced() to check if objects are uniquely referenced (gh-140062) 2025-10-15 09:48:21 -04:00
ld_so_aix.in Issue #10656: Fix out-of-tree building on AIX 2016-11-20 07:56:37 +00:00
main.c gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035) 2025-05-28 20:11:09 +03:00
makesetup gh-116943: Ensure makesetup does not choke on missing EOL in Setup.* files (#139100) 2025-09-18 09:25:01 +00:00
makexp_aix bpo-42087: Remove support for AIX 5.3 and below (GH-22830) 2020-11-16 16:16:10 +01:00
mathintegermodule.c gh-81313: Add the math.integer module (PEP-791) (GH-133909) 2025-10-31 16:13:43 +02:00
mathmodule.c gh-141004: soft-deprecate Py_INFINITY macro (#141033) 2025-11-12 13:44:49 +01:00
md5module.c gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
mmapmodule.c gh-116738: make mmap module thread-safe (#139237) 2025-10-09 12:00:47 +05:30
overlapped.c GH-131296: Remove unused variable from overlapped.c (GH-131590) 2025-04-16 22:44:57 +01:00
posixmodule.c gh-137109: refactor warning about threads when forking (#141438) 2025-11-12 18:15:16 -08:00
posixmodule.h gh-85283: Convert grp extension to the limited C API (#116611) 2024-03-12 00:46:53 +00:00
pwdmodule.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
pyexpat.c gh-140593: Fix a memory leak in function my_ElementDeclHandler of pyexpat (#140602) 2025-10-26 13:45:32 +00:00
readline.c gh-48752: Add readline.get_pre_input_hook() function (#141586) 2025-12-05 13:18:54 +01:00
README Issue #18093: Factor out the programs that embed the runtime 2014-07-25 21:52:14 +10:00
resource.c gh-137512: Add new constants in the resource module (GH-137513) 2025-08-19 08:52:45 +02:00
rotatingtree.c gh-116181: Remove Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE in rotatingtree.c (#121260) 2024-07-03 13:05:05 +05:30
rotatingtree.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
selectmodule.c gh-67795: Accept any real numbers as timestamp and timeout (GH-139224) 2025-09-23 21:31:42 +03:00
Setup gh-138122: Split Modules/_remote_debugging_module.c into multiple files (#141934) 2025-11-25 12:51:24 +00:00
Setup.bootstrap.in gh-136421: Load _datetime static types during interpreter initialization (GH-136583) 2025-07-21 13:47:26 -04:00
Setup.stdlib.in gh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads (#142137) 2025-12-06 22:37:34 +00:00
sha1module.c gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
sha2module.c gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
sha3module.c gh-138342: Move _PyObject_VisitType() to the internal C API (#139734) 2025-10-08 12:10:58 +02:00
signalmodule.c gh-67795: Accept any real numbers as timestamp and timeout (GH-139224) 2025-09-23 21:31:42 +03:00
socketmodule.c gh-141817: Add IPV6_HDRINCL constant to the socket module (#141818) 2025-11-22 18:07:21 +01:00
socketmodule.h gh-86819: Add ISO-TP CAN socket constants (#23794) 2025-09-17 17:18:04 +00:00
symtablemodule.c gh-135801: Add the module parameter to compile() etc (GH-139652) 2025-11-13 13:21:32 +02:00
syslogmodule.c gh-116738: Make syslog module thread-safe (#136760) 2025-07-21 09:24:42 -07:00
termios.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
timemodule.c Remove internal _PyTime_AsLong() function (#141053) 2025-11-05 18:37:06 +01:00
tkappinit.c gh-103538: Remove unused TK_AQUA code (GH-103539) 2023-05-10 18:53:13 +00:00
tkinter.h gh-103532: Remove TKINTER_PROTECT_LOADTK code (GH-103535) 2023-04-14 09:04:16 -05:00
unicodedata.c gh-129117: Add unicodedata.isxidstart() function (#140269) 2025-10-30 10:18:12 +00:00
unicodedata_db.h closes gh-138706: update Unicode to 17.0.0 (#138719) 2025-09-11 09:58:39 -07:00
unicodename_db.h closes gh-138706: update Unicode to 17.0.0 (#138719) 2025-09-11 09:58:39 -07:00
winreparse.h bpo-31512: Add non-elevated symlink support for Windows (GH-3652) 2019-04-09 11:19:46 -07:00
xxlimited.c gh-134160: Add more comments for the xxlimited module (GH-140214) 2025-10-27 11:39:42 +01:00
xxlimited_35.c gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
xxmodule.c gh-122040: reword Modules/xxmodule.c module-level comment (#132201) 2025-04-07 08:03:03 +00:00
xxsubtype.c gh-111178: fix UBSan failures in Modules/xx*.c (GH-129797) 2025-02-25 13:02:32 +01:00
zlibmodule.c gh-76007: Deprecate zlib.__version__ attribute (#140130) 2025-10-15 13:18:48 +02:00

Source files for standard library extension modules,
and former extension modules that are now builtin modules.