Skip to content

Commit 4bbcd5f

Browse files
DinoVfacebook-github-bot
authored andcommitted
Don't always initialize codeExtra
Summary: Currently we're eagerly initializing `codeExtra` for code objects. This isn't buying us much - we're allocating memory for every code object even if we don't need it. And this isn't even memory that we'll get to share between workers because the second we run a code object for the first time we'll COW it to update the count. But this is also causing issues in 3.14. There are tests that are arguably bad - they create a CoExtra free function that's written in Python and is marshalled out via c-types. When CPython frees the co_extra's it doesn't actually check to see if the value is NULL - it just blindly calls the free function. When we have these populated on all code objects it causes us to crash when w call the freed ctypes wrapper. Reviewed By: alexmalyshev Differential Revision: D79215117 fbshipit-source-id: a4e33871847436424e12e4fcbf7be30fbf867b35
1 parent 43888c9 commit 4bbcd5f

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

_cinderx-lib.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,6 @@ int get_current_code_flags(PyThreadState* tstate) {
652652
int cinderx_code_watcher(PyCodeEvent event, PyCodeObject* co) {
653653
switch (event) {
654654
case PY_CODE_EVENT_CREATE:
655-
initCodeExtra(co);
656655
break;
657656
case PY_CODE_EVENT_DESTROY:
658657
#if PY_VERSION_HEX < 0x030C0000

0 commit comments

Comments
 (0)