#ifndef VILE_MEMORY_GC_STATS_H #define VILE_MEMORY_GC_STATS_H #include /* The synchronized snapshot avoids an unsynchronized GC_get_gc_no() read. * Keep its scratch structure on the C stack so taking a measurement does not * introduce a GC allocation through V's conservative escape analysis. */ static inline size_t vile_memory_gc_no(void) { struct GC_prof_stats_s stats; GC_get_prof_stats(&stats, sizeof(stats)); return (size_t)stats.gc_no; } #endif