Skip to content
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

bpo-35053: Define _PyTraceMalloc_NewReference in object.h #10107

Merged
merged 1 commit into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,10 @@ PyAPI_FUNC(void) dec_count(PyTypeObject *);
#define _Py_COUNT_ALLOCS_COMMA
#endif /* COUNT_ALLOCS */

/* Update the Python traceback of an object. This function must be called
when a memory block is reused from a free list. */
PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op);

#ifdef Py_TRACE_REFS
/* Py_TRACE_REFS is such major surgery that we call external routines. */
PyAPI_FUNC(void) _Py_NewReference(PyObject *);
Expand Down
4 changes: 0 additions & 4 deletions Include/tracemalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ PyAPI_FUNC(int) PyTraceMalloc_Track(
uintptr_t ptr,
size_t size);

/* Update the Python traceback of an object.
This function can be used when a memory block is reused from a free list. */
PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op);

/* Untrack an allocated memory block in the tracemalloc module.
Do nothing if the block was not tracked.

Expand Down
3 changes: 3 additions & 0 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ _io -DPy_BUILD_CORE -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fil
faulthandler faulthandler.c

# debug tool to trace memory blocks allocated by Python
#
# bpo-35053: The module must be builtin since _Py_NewReference()
# can call _PyTraceMalloc_NewReference().
_tracemalloc _tracemalloc.c hashtable.c

# The rest of the modules listed in this file are all commented out by
Expand Down