Commit a35c6880 authored by Neil Schemenauer's avatar Neil Schemenauer

Add Vladimir Marangozov's object allocator. It is disabled by default. This

closes SF patch #401229.
parent 29906eef
......@@ -76,6 +76,13 @@ recommended to use PyObject_{New, NewVar, Del}. */
memory management purposes exclusively. Both the core and extension
modules should use the PyObject_* API. */
#ifdef WITH_PYMALLOC
#define PyCore_OBJECT_MALLOC_FUNC _PyCore_ObjectMalloc
#define PyCore_OBJECT_REALLOC_FUNC _PyCore_ObjectRealloc
#define PyCore_OBJECT_FREE_FUNC _PyCore_ObjectFree
#define NEED_TO_DECLARE_OBJECT_MALLOC_AND_FRIEND
#endif /* !WITH_PYMALLOC */
#ifndef PyCore_OBJECT_MALLOC_FUNC
#undef PyCore_OBJECT_REALLOC_FUNC
#undef PyCore_OBJECT_FREE_FUNC
......
......@@ -399,6 +399,7 @@ Python/getplatform.o: $(srcdir)/Python/getplatform.c
Python/importdl.o: $(srcdir)/Python/importdl.c
$(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
$(srcdir)/Objects/unicodetype_db.h
......
......@@ -3,6 +3,15 @@ What's New in Python 2.1 alpha 507?
Core language, builtins, and interpreter
- An optional object allocator has been included. This allocator is
optimized for Python objects and should be faster and use less memory
than the standard system allocator. It is not enabled by default
because of possible thread safety problems. The allocator is only
protected by the Python interpreter lock and it is possible that some
extension modules require a thread safe allocator. The object
allocator can be enabled by providing the "--with-pymalloc" option to
configure.
Standard library
- pyexpat now detects the expat version if expat.h defines it. A
......
......@@ -1641,3 +1641,7 @@ _PyTrash_destroy_chain(void)
--_PyTrash_delete_nesting;
}
}
#ifdef WITH_PYMALLOC
#include "obmalloc.c"
#endif
This diff is collapsed.
......@@ -175,6 +175,9 @@
/* Define if you want to use ndbm. */
#undef WITH_LIBNDBM
/* Define if you want to compile in Python-specific mallocs */
#undef WITH_PYMALLOC
/* Define if you want to produce an OpenStep/Rhapsody framework
(shared library plus accessory files). */
#undef WITH_NEXT_FRAMEWORK
......
......@@ -222,6 +222,9 @@
linker (rld). Dyld is necessary to support frameworks. */
#undef WITH_DYLD
/* Define if you want to compile in Python-specific mallocs */
#undef WITH_PYMALLOC
/* Define if you want to produce an OpenStep/Rhapsody framework
(shared library plus accessory files). */
#undef WITH_NEXT_FRAMEWORK
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -856,6 +856,16 @@ else
fi
AC_MSG_RESULT($with_cycle_gc)
# Check for Python-specific malloc support
AC_MSG_CHECKING(for --with-pymalloc)
AC_ARG_WITH(pymalloc,
[ --with(out)-pymalloc disable/enable specialized mallocs], [
if test "$withval" != no
then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
else AC_MSG_RESULT(no)
fi],
[AC_MSG_RESULT(no)])
# Check for --with-wctype-functions
AC_MSG_CHECKING(for --with-wctype-functions)
AC_ARG_WITH(wctype-functions,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment