summaryrefslogtreecommitdiffstats
path: root/Objects/obmalloc.c
Commit message (Collapse)AuthorAgeFilesLines
* correct silly spelling problemBenjamin Peterson2016-09-191-9/+9
|
* replace obmalloc's homegrown uptr and uchar types with standard onesBenjamin Peterson2016-09-191-42/+31
|
* improvements to code that checks whether Python (obmalloc) allocated an addressBenjamin Peterson2016-09-191-76/+22
| | | | | | | | | | | | | | - Rename Py_ADDRESS_IN_RANGE to address_in_range and make it a static function instead of macro. Any compiler worth its salt will inline this function. - Remove the duplicated function version of Py_ADDRESS_IN_RANGE used when memory analysis was active. Instead, we can simply mark address_in_range as allergic to dynamic memory checking. We can now remove the __attribute__((no_address_safety_analysis)) from _PyObject_Free and _PyObject_Realloc. All the badness is contained in address_in_range now. - Fix the code that tried to only read pool->arenaindex once. Putting something in a variable is no guarantee that it won't be read multiple times. We must use volatile for that.
* replace PY_SIZE_MAX with SIZE_MAXBenjamin Peterson2016-09-071-1/+1
|
* replace Py_(u)intptr_t with the c99 standard typesBenjamin Peterson2016-09-061-1/+1
|
* Issue #26249: Try test_capi on WindowsVictor Stinner2016-04-221-6/+7
|
* PyMem_Malloc() now uses the fast pymalloc allocatorVictor Stinner2016-04-221-3/+3
| | | | | | | Issue #26249: PyMem_Malloc() allocator family now uses the pymalloc allocator rather than system malloc(). Applications calling PyMem_Malloc() without holding the GIL can now crash: use PYTHONMALLOC=debug environment variable to validate the usage of memory allocators in your application.
* Don't define _PyMem_PymallocEnabled() if pymalloc is disabledVictor Stinner2016-04-191-1/+1
| | | | Isse #26516.
* _PyMem_DebugFree(): fix compiler warning on WindowsVictor Stinner2016-03-231-1/+1
| | | | Don't return a void value.
* Fail if PyMem_Malloc() is called without holding the GILVictor Stinner2016-03-161-7/+7
| | | | | Issue #26563: Debug hooks on Python memory allocators now raise a fatal error if functions of the PyMem_Malloc() family are called without holding the GIL.
* On memory error, dump the memory block tracebackVictor Stinner2016-03-151-0/+9
| | | | | | Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a memory block was allocated on memory block. Use the tracemalloc module to get the traceback.
* Check the GIL in PyObject_Malloc()Victor Stinner2016-03-141-22/+70
| | | | | Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is held when the function is called.
* Add PYTHONMALLOC env varVictor Stinner2016-03-141-59/+132
| | | | | | | | | | | | | Issue #26516: * Add PYTHONMALLOC environment variable to set the Python memory allocators and/or install debug hooks. * PyMem_SetupDebugHooks() can now also be used on Python compiled in release mode. * The PYTHONMALLOCSTATS environment variable can now also be used on Python compiled in release mode. It now has no effect if set to an empty string. * In debug mode, debug hooks are now also installed on Python memory allocators when Python is configured without pymalloc.
* Issue #23450: Fixed possible integer overflows.Serhiy Storchaka2015-02-161-1/+1
|
* Issue #22335: Fix crash when trying to enlarge a bytearray to 0x7fffffff ↵Antoine Pitrou2014-11-021-4/+4
|\ | | | | | | bytes on a 32-bit platform.
| * Issue #22335: Fix crash when trying to enlarge a bytearray to 0x7fffffff ↵Antoine Pitrou2014-11-021-4/+4
| | | | | | | | bytes on a 32-bit platform.
* | Issue #21233: Rename the C structure "PyMemAllocator" to "PyMemAllocatorEx" toVictor Stinner2014-06-021-7/+7
| | | | | | | | | | make sure that the code using it will be adapted for the new "calloc" field (instead of crashing).
* | Issue #21233: Fix _PyObject_Alloc() when compiled with WITH_VALGRIND definedVictor Stinner2014-05-061-3/+3
| |
* | Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going toVictor Stinner2014-05-021-3/+3
| | | | | | | | redirect.
* | Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),Victor Stinner2014-05-021-17/+109
|/ | | | | | PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int) are now using ``calloc()`` instead of ``malloc()`` for large objects which is faster and use less memory (until the bytearray buffer is filled with data).
* Issue #18874: _PyObject_Malloc/Realloc/Free() now falls back onVictor Stinner2013-10-101-17/+19
| | | | | | _PyMem_RawMalloc/Realloc/Free, instead of _PyMem_Malloc/Realloc/Free. So it becomes possible to use the fast pymalloc allocator for the PYMEM_DOMAIN_MEM domain (PyMem_Malloc/Realloc/Free functions).
* Close #18596: Support address sanity checking in clang/GCCNick Coghlan2013-09-281-0/+20
| | | | | | This patch appropriately marks known false alarms in the small object allocator when address sanity checking is enabled (patch contributed by Dhiru Kholia).
* Fix minor typo.Georg Brandl2013-09-251-1/+1
|
* Update internal comments to say _something_ about the "API ID".Tim Peters2013-09-201-1/+3
| | | | Best I can tell, the possible values for this aren't documented anywhere.
* Nerge 3.3 into default.Tim Peters2013-09-061-1/+1
|\ | | | | | | | | | | | | | | Issue #18942: sys._debugmallocstats() output was damaged on Windows. _PyDebugAllocatorStats() called PyOS_snprintf() with a %zd format code, but MS doesn't support that code. Interpolated PY_FORMAT_SIZE_T in place of the "z".
| * Issue #18942: sys._debugmallocstats() output was damaged on Windows.Tim Peters2013-09-061-1/+1
| | | | | | | | | | | | _PyDebugAllocatorStats() called PyOS_snprintf() with a %zd format code, but MS doesn't support that code. Interpolated PY_FORMAT_SIZE_T in place of the "z".
* | Issue #18408: Fix _PyMem_DebugRealloc()Victor Stinner2013-07-081-6/+8
| | | | | | | | | | | | | | | | Don't mark old extra memory dead before calling realloc(). realloc() can fail and realloc() must not touch the original buffer on failure. So mark old extra memory dead only on success if the new buffer did not move (has the same address).
* | Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()Victor Stinner2013-07-071-0/+28
| | | | | | | | | | Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the GIL is held or not.
* | Issue #3329: Fix _PyObject_ArenaVirtualFree()Victor Stinner2013-07-071-1/+1
| | | | | | | | | | According to VirtualFree() documentation, the size must be zero if the "free type" is MEM_RELEASE.
* | Issue #3329: Implement the PEP 445Victor Stinner2013-07-071-149/+355
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new enum: * PyMemAllocatorDomain Add new structures: * PyMemAllocator * PyObjectArenaAllocator Add new functions: * PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() * PyMem_GetAllocator(), PyMem_SetAllocator() * PyObject_GetArenaAllocator(), PyObject_SetArenaAllocator() * PyMem_SetupDebugHooks() Changes: * PyMem_Malloc()/PyObject_Realloc() now always call malloc()/realloc(), instead of calling PyObject_Malloc()/PyObject_Realloc() in debug mode. * PyObject_Malloc()/PyObject_Realloc() now falls back to PyMem_Malloc()/PyMem_Realloc() for allocations larger than 512 bytes. * Redesign debug checks on memory block allocators as hooks, instead of using C macros
* | Issue #13483: Use VirtualAlloc in obmalloc on Windows.Martin v. Löwis2013-06-271-2/+12
| |
* | Revert changeset 6661a8154eb3: Issue #3329: Add new APIs to customize memory ↵Victor Stinner2013-06-151-364/+137
| | | | | | | | | | | | allocators The new API require more discussion.
* | Issue #3329: Add new APIs to customize memory allocatorsVictor Stinner2013-06-141-137/+364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a new PyMemAllocators structure * New functions: - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory allocator functions - PyMem_GetRawAllocators(), PyMem_SetRawAllocators() - PyMem_GetAllocators(), PyMem_SetAllocators() - PyMem_SetupDebugHooks() - _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators() * Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0) * Add unit test for new get/set allocators functions * PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls back on PyMem_Realloc() instead of realloc() * PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(), instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
* | Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() when ↵Antoine Pitrou2013-04-051-3/+5
| | | | | | | | running on valgrind.
* | merge 3.3 (#17228)Benjamin Peterson2013-02-201-1/+1
|\ \ | |/
| * fix building without pymalloc (closes #17228)Benjamin Peterson2013-02-201-1/+1
| |
* | Following issue #13390, fix compilation --without-pymalloc, and make ↵Antoine Pitrou2012-12-171-0/+7
| | | | | | | | sys.getallocatedblocks() return 0 in that situation.
* | Issue #13390: New function :func:`sys.getallocatedblocks()` returns the ↵Antoine Pitrou2012-12-091-1/+20
|/ | | | | | number of memory blocks currently allocated. Also, the ``-R`` option to regrtest uses this function to guard against memory allocation leaks.
* Issue #15144: Fix possible integer overflow when handling pointers as ↵Antoine Pitrou2012-09-201-5/+2
| | | | | | integer values, by using Py_uintptr_t instead of size_t. Patch by Serhiy Storchaka.
* Issue #14785: Add sys._debugmallocstats() to help debug low-level memory ↵David Malcolm2012-06-221-33/+48
| | | | allocation issues
* Close #14232: catch mmap() failure in new_arena() of obmallocVictor Stinner2012-03-091-3/+8
|
* Better resolution for issue #11849: Ensure that free()d memory arenas are ↵Antoine Pitrou2011-11-261-15/+22
| | | | | | really released on POSIX systems supporting anonymous memory mappings. Patch by Charles-François Natali.
* Issue #11849: Make it more likely for the system allocator to releaseAntoine Pitrou2011-05-031-6/+23
| | | | | free()d memory arenas on glibc-based systems. Patch by Charles-François Natali.
* Issue #8914: fix various warnings from the Clang static analyzer v254.Brett Cannon2011-02-221-2/+0
|
* Issue #8020: Avoid a crash where the small objects allocator would readAntoine Pitrou2011-01-071-6/+22
| | | | | non-Python managed memory while it is being modified by another thread. Patch by Matt Bandy.
* Indentation cleanup.Stefan Krah2010-11-261-9/+9
|
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-1073/+1073
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* Merged revisions 76644 via svnmerge fromBenjamin Peterson2009-12-031-0/+39
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r76644 | benjamin.peterson | 2009-12-02 20:52:39 -0600 (Wed, 02 Dec 2009) | 4 lines disable pymalloc tricks with the --with-valgrind option #2422 Patch from James Henstridge. ........
* merging revision 75106 from trunk:Kristján Valur Jónsson2009-09-281-1/+1
| | | | | http://bugs.python.org/issue6836 A missing 'const' wasn't detected by Visual Studio.
* http://bugs.python.org/issue6836Kristján Valur Jónsson2009-09-281-17/+87
| | | | Merging revisions 75103,75104 from trunk to py3k