Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16943)

Side by Side Diff: Include/objimpl.h

Issue 13390: Hunt memory allocations in addition to reference leaks
Patch Set: Created 6 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/sys.rst ('k') | Lib/test/regrtest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* The PyObject_ memory family: high-level object memory interfaces. 1 /* The PyObject_ memory family: high-level object memory interfaces.
2 See pymem.h for the low-level PyMem_ family. 2 See pymem.h for the low-level PyMem_ family.
3 */ 3 */
4 4
5 #ifndef Py_OBJIMPL_H 5 #ifndef Py_OBJIMPL_H
6 #define Py_OBJIMPL_H 6 #define Py_OBJIMPL_H
7 7
8 #include "pymem.h" 8 #include "pymem.h"
9 9
10 #ifdef __cplusplus 10 #ifdef __cplusplus
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 possible. The PyObject_{Malloc, Realloc, Free} family is exposed 91 possible. The PyObject_{Malloc, Realloc, Free} family is exposed
92 so that you can exploit Python's small-block allocator for non-object 92 so that you can exploit Python's small-block allocator for non-object
93 uses. If you must use these routines to allocate object memory, make sure 93 uses. If you must use these routines to allocate object memory, make sure
94 the object gets initialized via PyObject_{Init, InitVar} after obtaining 94 the object gets initialized via PyObject_{Init, InitVar} after obtaining
95 the raw memory. 95 the raw memory.
96 */ 96 */
97 PyAPI_FUNC(void *) PyObject_Malloc(size_t); 97 PyAPI_FUNC(void *) PyObject_Malloc(size_t);
98 PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t); 98 PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t);
99 PyAPI_FUNC(void) PyObject_Free(void *); 99 PyAPI_FUNC(void) PyObject_Free(void *);
100 100
101 /* This function returns the number of allocated memory blocks, regardless of si ze */
102 PyAPI_FUNC(Py_ssize_t) _Py_GetAllocedBlocks(void);
101 103
102 /* Macros */ 104 /* Macros */
103 #ifdef WITH_PYMALLOC 105 #ifdef WITH_PYMALLOC
104 #ifndef Py_LIMITED_API 106 #ifndef Py_LIMITED_API
105 PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out); 107 PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out);
106 #endif /* #ifndef Py_LIMITED_API */ 108 #endif /* #ifndef Py_LIMITED_API */
107 #ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */ 109 #ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */
108 PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); 110 PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes);
109 PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); 111 PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes);
110 PyAPI_FUNC(void) _PyObject_DebugFree(void *p); 112 PyAPI_FUNC(void) _PyObject_DebugFree(void *p);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 /* Test if a type supports weak references */ 330 /* Test if a type supports weak references */
329 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) 331 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
330 332
331 #define PyObject_GET_WEAKREFS_LISTPTR(o) \ 333 #define PyObject_GET_WEAKREFS_LISTPTR(o) \
332 ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) 334 ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
333 335
334 #ifdef __cplusplus 336 #ifdef __cplusplus
335 } 337 }
336 #endif 338 #endif
337 #endif /* !Py_OBJIMPL_H */ 339 #endif /* !Py_OBJIMPL_H */
OLDNEW
« no previous file with comments | « Doc/library/sys.rst ('k') | Lib/test/regrtest.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+