debug flag for running a GC every n'th allocation
This commit is contained in:
parent
6c2334812c
commit
fcc939dbed
@ -445,6 +445,7 @@ Most toggles require a value of `1` to be enabled.
|
||||
#define VERIFY_TAIL (u) // number of bytes after the end of an array to verify not being improperly modified; 64 in DEBUG
|
||||
#define NEEQUAL_NEGZERO 0 // make negative zero not equal zero for •internal.EEqual
|
||||
#define RT_VERIFY_ARGS 1 // rtverify: preserve arguments for printing on failure
|
||||
#define GC_EVERY_NTH_ALLOC (u) // force a GC on every n'th allocation (<=1 to GC on every alloc)
|
||||
|
||||
// some somewhat-outdated/unmaintained things:
|
||||
#define RT_PERF 0 // time runtime primitives
|
||||
|
||||
@ -340,10 +340,24 @@ static FC2 c2fn(B f) {
|
||||
NOINLINE NORETURN void thrOOMTest(void);
|
||||
#endif
|
||||
|
||||
#ifdef GC_EVERY_NTH_ALLOC
|
||||
extern u64 gc_depth;
|
||||
extern u64 nth_alloc;
|
||||
#endif
|
||||
FORCE_INLINE void preAlloc(usz sz, u8 type) {
|
||||
#ifdef OOM_TEST
|
||||
if (--oomTestLeft==0) thrOOMTest();
|
||||
#endif
|
||||
#ifdef GC_EVERY_NTH_ALLOC
|
||||
#if GC_EVERY_NTH_ALLOC<=1
|
||||
if (gc_depth==0) gc_forceGC(false);
|
||||
#else
|
||||
if (gc_depth==0 && --nth_alloc == 0) {
|
||||
gc_forceGC(false);
|
||||
nth_alloc = GC_EVERY_NTH_ALLOC;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if ALLOC_STAT
|
||||
if (!ctr_a) {
|
||||
#if ALLOC_SIZES
|
||||
|
||||
@ -12,6 +12,9 @@
|
||||
|
||||
|
||||
u64 gc_depth = 1;
|
||||
#ifdef GC_EVERY_NTH_ALLOC
|
||||
u64 nth_alloc = 1;
|
||||
#endif
|
||||
|
||||
|
||||
vfn gc_roots[8];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user