mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
increase gc threshold
This commit is contained in:
parent
8e41139616
commit
d3c33c2d1c
@ -24,6 +24,11 @@
|
|||||||
#define PK_ENABLE_CEVAL_CALLBACK 0
|
#define PK_ENABLE_CEVAL_CALLBACK 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// GC min threshold
|
||||||
|
#ifndef PK_GC_MIN_THRESHOLD // can be overrided by cmake
|
||||||
|
#define PK_GC_MIN_THRESHOLD 32768
|
||||||
|
#endif
|
||||||
|
|
||||||
// Whether to use `std::function` to do bindings or not
|
// Whether to use `std::function` to do bindings or not
|
||||||
// By default, functions to be binded must be a C function pointer without capture
|
// By default, functions to be binded must be a C function pointer without capture
|
||||||
// However, someone thinks it's not convenient.
|
// However, someone thinks it's not convenient.
|
||||||
|
@ -16,8 +16,7 @@ struct ManagedHeap{
|
|||||||
|
|
||||||
ManagedHeap(VM* vm): vm(vm) {}
|
ManagedHeap(VM* vm): vm(vm) {}
|
||||||
|
|
||||||
static const int kMinGCThreshold = 3072;
|
int gc_threshold = PK_GC_MIN_THRESHOLD;
|
||||||
int gc_threshold = kMinGCThreshold;
|
|
||||||
int gc_counter = 0;
|
int gc_counter = 0;
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
|
@ -36,7 +36,7 @@ namespace pkpy{
|
|||||||
gc_counter = 0;
|
gc_counter = 0;
|
||||||
collect();
|
collect();
|
||||||
gc_threshold = gen.size() * 2;
|
gc_threshold = gen.size() * 2;
|
||||||
if(gc_threshold < kMinGCThreshold) gc_threshold = kMinGCThreshold;
|
if(gc_threshold < PK_GC_MIN_THRESHOLD) gc_threshold = PK_GC_MIN_THRESHOLD;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user