summaryrefslogtreecommitdiff
path: root/Programs
diff options
context:
space:
mode:
Diffstat (limited to 'Programs')
-rw-r--r--Programs/_testembed.c2
-rw-r--r--Programs/python.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index ab6a8c7507..39683993ea 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -41,7 +41,7 @@ static void test_repeated_init_and_subinterpreters(void)
#endif
int i, j;
- for (i=0; i<3; i++) {
+ for (i=0; i<15; i++) {
printf("--- Pass %d ---\n", i);
_testembed_Py_Initialize();
mainstate = PyThreadState_Get();
diff --git a/Programs/python.c b/Programs/python.c
index 37b10b837e..a7afbc774b 100644
--- a/Programs/python.c
+++ b/Programs/python.c
@@ -24,6 +24,9 @@ main(int argc, char **argv)
int i, res;
char *oldloc;
+ /* Force malloc() allocator to bootstrap Python */
+ (void)_PyMem_SetupAllocators("malloc");
+
argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
if (!argv_copy || !argv_copy2) {
@@ -62,7 +65,13 @@ main(int argc, char **argv)
setlocale(LC_ALL, oldloc);
PyMem_RawFree(oldloc);
+
res = Py_Main(argc, argv_copy);
+
+ /* Force again malloc() allocator to release memory blocks allocated
+ before Py_Main() */
+ (void)_PyMem_SetupAllocators("malloc");
+
for (i = 0; i < argc; i++) {
PyMem_RawFree(argv_copy2[i]);
}