remove PK_LOW_MEMORY_MODE

This commit is contained in:
blueloveTH 2025-04-13 13:59:04 +08:00
parent f7141d5967
commit dacb1091db
2 changed files with 3 additions and 17 deletions

View File

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

View File

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