diff -up Python-2.6.5/configure.ac.more-configuration-flags Python-2.6.5/configure.ac
--- Python-2.6.5/configure.ac.more-configuration-flags	2010-05-24 18:51:25.410111792 -0400
+++ Python-2.6.5/configure.ac	2010-05-24 18:59:23.954986388 -0400
@@ -2515,6 +2515,30 @@ else AC_MSG_RESULT(no)
 fi],
 [AC_MSG_RESULT(no)])
 
+AC_MSG_CHECKING(for --with-count-allocs)
+AC_ARG_WITH(count-allocs,
+[  --with(out)count-allocs  enable/disable per-type instance accounting], [
+if test "$withval" != no
+then 
+  AC_DEFINE(COUNT_ALLOCS, 1,
+    [Define to keep records of the number of instances of each type]) 
+    AC_MSG_RESULT(yes)
+else AC_MSG_RESULT(no)
+fi],
+[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for --with-call-profile)
+AC_ARG_WITH(call-profile,
+[  --with(out)-call-profile  enable/disable statistics on function call invocation], [
+if test "$withval" != no
+then 
+  AC_DEFINE(CALL_PROFILE, 1, 
+    [Define to keep records on function call invocation]) 
+    AC_MSG_RESULT(yes)
+else AC_MSG_RESULT(no)
+fi],
+[AC_MSG_RESULT(no)])
+
 # Check for Python-specific malloc support
 AC_MSG_CHECKING(for --with-pymalloc)
 AC_ARG_WITH(pymalloc,
diff -up Python-2.6.5/pyconfig.h.in.more-configuration-flags Python-2.6.5/pyconfig.h.in
--- Python-2.6.5/pyconfig.h.in.more-configuration-flags	2010-05-24 18:51:45.677988086 -0400
+++ Python-2.6.5/pyconfig.h.in	2010-05-24 19:00:44.163987730 -0400
@@ -1019,6 +1019,12 @@
 /* Define to profile with the Pentium timestamp counter */
 #undef WITH_TSC
 
+/* Define to keep records of the number of instances of each type */
+#undef COUNT_ALLOCS
+
+/* Define to keep records on function call invocation */
+#undef CALL_PROFILE
+
 /* Define if you want pymalloc to be disabled when running under valgrind */
 #undef WITH_VALGRIND
 
