https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97461
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Hmm, is the TOPN allocation strathegy configurable? I wonder whether we have to resort to an alternate allocation scheme (mmap/sbrk), avoiding libc? At least I don't see a good way to force the gcov allocation to call the libc malloc rather than a user replacement that is being instrumented. Of course the instrumentation code could do sth like if (is_allocated == 0) { is_allocated = in_progress; ... = malloc (); is_allocated = 1; } else if (is_allocted == in_progress) { topn_mem = &transitional_garbage_space; } but of course that's quite some overhead for a small benefit. Maybe it could be hidden in gcov_malloc.