Skip to content

gh-117657: initialize_new_array #118769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TSAN: move gc counter reset into critical section
  • Loading branch information
SonicField committed Apr 26, 2024
commit edd9b7b9bbded7cfbfd11d2dbfde3ccaff4bc45d
25 changes: 13 additions & 12 deletions Python/gc_free_threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,9 +1038,20 @@ record_deallocation(PyThreadState *tstate)
}

static void
gc_collect_internal(PyInterpreterState *interp, struct collection_state *state)
gc_collect_internal(PyInterpreterState *interp, struct collection_state *state, int generation)
{
_PyEval_StopTheWorld(interp);

// update collection and allocation counters
if (generation+1 < NUM_GENERATIONS) {
state->gcstate->old[generation].count += 1;
}

state->gcstate->young.count = 0;
for (size_t i = 1; i <= generation; ++i) {
state->gcstate->old[i-1].count = 0;
}

// merge refcounts for all queued objects
merge_all_queued_objects(interp, state);
process_delayed_frees(interp);
Expand Down Expand Up @@ -1155,24 +1166,14 @@ gc_collect_main(PyThreadState *tstate, int generation, _PyGC_Reason reason)
PyDTrace_GC_START(generation);
}

/* update collection and allocation counters */
if (generation+1 < NUM_GENERATIONS) {
gcstate->old[generation].count += 1;
}

_Py_atomic_store_int(&gcstate->young.count, 0);
for (i = 1; i <= generation; i++) {
gcstate->old[i-1].count = 0;
}

PyInterpreterState *interp = tstate->interp;

struct collection_state state = {
.interp = interp,
.gcstate = gcstate,
};

gc_collect_internal(interp, &state);
gc_collect_internal(interp, &state, generation);

m = state.collected;
n = state.uncollectable;
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy