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

Delta Between Two Patch Sets: Python/sysmodule.c

Issue 13390: Hunt memory allocations in addition to reference leaks
Left Patch Set: Created 6 years, 9 months ago
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Python/pythonrun.c ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 1
2 /* System module */ 2 /* System module */
3 3
4 /* 4 /*
5 Various bits of information used by the interpreter are collected in 5 Various bits of information used by the interpreter are collected in
6 module 'sys'. 6 module 'sys'.
7 Function member: 7 Function member:
8 - exit(sts): raise SystemExit 8 - exit(sts): raise SystemExit
9 Data members: 9 Data members:
10 - stdin, stdout, stderr: standard file objects 10 - stdin, stdout, stderr: standard file objects
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 Return the reference count of object. The count returned is generally\n\ 892 Return the reference count of object. The count returned is generally\n\
893 one higher than you might expect, because it includes the (temporary)\n\ 893 one higher than you might expect, because it includes the (temporary)\n\
894 reference as an argument to getrefcount()." 894 reference as an argument to getrefcount()."
895 ); 895 );
896 896
897 static PyObject * 897 static PyObject *
898 sys_getallocatedblocks(PyObject *self) 898 sys_getallocatedblocks(PyObject *self)
899 { 899 {
900 return PyLong_FromSsize_t(_Py_GetAllocedBlocks()); 900 return PyLong_FromSsize_t(_Py_GetAllocedBlocks());
901 } 901 }
902
903 PyDoc_STRVAR(getallocatedblocks_doc,
904 "getallocatedblocks() -> integer\n\
905 \n\
906 Return the number of memory blocks currently allocated, regardless of their\n\
907 size."
908 );
902 909
903 #ifdef COUNT_ALLOCS 910 #ifdef COUNT_ALLOCS
904 static PyObject * 911 static PyObject *
905 sys_getcounts(PyObject *self) 912 sys_getcounts(PyObject *self)
906 { 913 {
907 extern PyObject *get_counts(void); 914 extern PyObject *get_counts(void);
908 915
909 return get_counts(); 916 return get_counts();
910 } 917 }
911 #endif 918 #endif
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 {"displayhook", sys_displayhook, METH_O, displayhook_doc}, 1068 {"displayhook", sys_displayhook, METH_O, displayhook_doc},
1062 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, 1069 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc},
1063 {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, 1070 {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
1064 {"exit", sys_exit, METH_VARARGS, exit_doc}, 1071 {"exit", sys_exit, METH_VARARGS, exit_doc},
1065 {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, 1072 {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding,
1066 METH_NOARGS, getdefaultencoding_doc}, 1073 METH_NOARGS, getdefaultencoding_doc},
1067 #ifdef HAVE_DLOPEN 1074 #ifdef HAVE_DLOPEN
1068 {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, 1075 {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS,
1069 getdlopenflags_doc}, 1076 getdlopenflags_doc},
1070 #endif 1077 #endif
1071 {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS}, 1078 {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS,
1079 getallocatedblocks_doc},
1072 #ifdef COUNT_ALLOCS 1080 #ifdef COUNT_ALLOCS
1073 {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS}, 1081 {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS},
1074 #endif 1082 #endif
1075 #ifdef DYNAMIC_EXECUTION_PROFILE 1083 #ifdef DYNAMIC_EXECUTION_PROFILE
1076 {"getdxp", _Py_GetDXProfile, METH_VARARGS}, 1084 {"getdxp", _Py_GetDXProfile, METH_VARARGS},
1077 #endif 1085 #endif
1078 {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, 1086 {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding,
1079 METH_NOARGS, getfilesystemencoding_doc}, 1087 METH_NOARGS, getfilesystemencoding_doc},
1080 #ifdef Py_TRACE_REFS 1088 #ifdef Py_TRACE_REFS
1081 {"getobjects", _Py_GetObjects, METH_VARARGS}, 1089 {"getobjects", _Py_GetObjects, METH_VARARGS},
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 2094
2087 void 2095 void
2088 PySys_FormatStderr(const char *format, ...) 2096 PySys_FormatStderr(const char *format, ...)
2089 { 2097 {
2090 va_list va; 2098 va_list va;
2091 2099
2092 va_start(va, format); 2100 va_start(va, format);
2093 sys_format("stderr", stderr, format, va); 2101 sys_format("stderr", stderr, format, va);
2094 va_end(va); 2102 va_end(va);
2095 } 2103 }
LEFTRIGHT

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