blueloveTH 10 месяцев назад
Родитель
Сommit
dacb1091db
2 измененных файлов с 3 добавлено и 17 удалено
  1. 2 16
      include/pocketpy/config.h
  2. 1 1
      src/interpreter/heap.c

+ 2 - 16
include/pocketpy/config.h

@@ -7,12 +7,6 @@
 #define PK_VERSION_PATCH            8
 
 /*************** feature settings ***************/
-
-// Reduce the startup memory usage for embedded systems
-#ifndef PK_LOW_MEMORY_MODE          // can be overridden by cmake
-#define PK_LOW_MEMORY_MODE          0
-#endif
-
 // Whether to compile os-related modules or not
 #ifndef PK_ENABLE_OS                // can be overridden by cmake
 #define PK_ENABLE_OS                1
@@ -20,11 +14,7 @@
 
 // GC min threshold
 #ifndef PK_GC_MIN_THRESHOLD         // can be overridden by cmake
-    #if PK_LOW_MEMORY_MODE
-        #define PK_GC_MIN_THRESHOLD     2048
-    #else
-        #define PK_GC_MIN_THRESHOLD     32768
-    #endif
+    #define PK_GC_MIN_THRESHOLD     32768
 #endif
 
 // Memory allocation functions
@@ -37,11 +27,7 @@
 // This is the maximum size of the value stack in py_TValue units
 // The actual size in bytes equals `sizeof(py_TValue) * PK_VM_STACK_SIZE`
 #ifndef PK_VM_STACK_SIZE            // can be overridden by cmake
-    #if PK_LOW_MEMORY_MODE
-        #define PK_VM_STACK_SIZE    2048
-    #else
-        #define PK_VM_STACK_SIZE    16384
-    #endif
+    #define PK_VM_STACK_SIZE        8192
 #endif
 
 // This is the maximum number of local variables in a function

+ 1 - 1
src/interpreter/heap.c

@@ -81,7 +81,7 @@ PyObject* ManagedHeap__gcnew(ManagedHeap* self, py_Type type, int slots, int uds
     PyObject* obj;
     // header + slots + udsize
     int size = sizeof(PyObject) + PK_OBJ_SLOTS_SIZE(slots) + udsize;
-    if(!PK_LOW_MEMORY_MODE && size <= kPoolMaxBlockSize) {
+    if(size <= kPoolMaxBlockSize) {
         obj = MultiPool__alloc(&self->small_objects, size);
         assert(obj != NULL);
     } else {