Skip to content

Instantly share code, notes, and snippets.

@kassane
Last active April 29, 2024 13:57
Show Gist options
  • Save kassane/c95d09d07a12474eacd78221d02fd919 to your computer and use it in GitHub Desktop.
Save kassane/c95d09d07a12474eacd78221d02fd919 to your computer and use it in GitHub Desktop.
BoehmGC based on `std::pmr::memory_resource`
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:UnknownInlinedFun
fun:GC_init
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:UnknownInlinedFun
fun:GC_init
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:UnknownInlinedFun
fun:GC_add_to_black_list_stack.lto_priv.0
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:UnknownInlinedFun
fun:GC_add_to_black_list_stack.lto_priv.0
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_add_to_black_list_stack.lto_priv.0
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_add_to_black_list_stack.lto_priv.0
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_add_to_black_list_stack.lto_priv.0
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:UnknownInlinedFun
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:UnknownInlinedFun
fun:UnknownInlinedFun
fun:GC_push_all_eager
fun:GC_with_callee_saves_pushed
fun:UnknownInlinedFun
fun:GC_push_roots.lto_priv.0
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_header_cache_miss.lto_priv.0
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_header_cache_miss.lto_priv.0
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Value8
fun:GC_push_contents_hdr.isra.0
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:GC_push_contents_hdr.isra.0
fun:GC_mark_from
fun:GC_mark_some
fun:GC_stopped_mark
fun:GC_try_to_collect_inner.lto_priv.0
fun:GC_try_to_collect_general
fun:GC_gcollect
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
#include <cassert>
#include <cstdio>
#include <gc_cpp.h>
#include <memory_resource>
#include <string>
#include <vector>
// gc_allocator<T> alternative
class GCMemoryResource : public std::pmr::memory_resource {
public:
std::size_t size() {
return static_cast<std::size_t>(GC_get_heap_size());
}
protected:
void *do_allocate(std::size_t bytes, std::size_t /*alignment*/) override {
return GC_MALLOC(bytes);
}
void do_deallocate(void *p, std::size_t /*bytes*/,
std::size_t /*alignment*/) override {
GC_FREE(p);
}
bool do_is_equal(const memory_resource &other) const noexcept override {
return &other == this;
}
};
template <typename T> using GCAllocator = std::pmr::polymorphic_allocator<T>;
struct Foo {
int x;
std::string s;
};
int main() {
GC_set_find_leak(1);
GC_INIT();
GCMemoryResource alloc;
std::pmr::vector<int> v(&alloc);
for (int i = 0; i < 100; ++i) {
v.push_back(i * i);
}
assert(GC_get_heap_size() == 65536);
// Detect leaks
GCMemoryResource gc_resource;
{
GCAllocator<Foo> alloc(&gc_resource);
// Allocate an object
auto f = alloc.allocate(1);
alloc.construct(f, Foo{10, "hello"});
// Lose reference to cause leak
alloc.destroy(f);
}
}
/*
VALGRIND SUPPRESSED
valgrind --leak-check=full --show-reachable=yes --track-origins=yes --show-leak-kinds=all --suppressions=bdwgc.supp ./gc_test
==40030== Memcheck, a memory error detector
==40030== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==40030== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==40030== Command: ./gc_test
==40030==
==40030==
==40030== HEAP SUMMARY:
==40030== in use at exit: 0 bytes in 0 blocks
==40030== total heap usage: 7 allocs, 7 frees, 2,072 bytes allocated
==40030==
==40030== All heap blocks were freed -- no leaks are possible
==40030==
==40030== For lists of detected and suppressed errors, rerun with: -s
==40030== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 481 from 41)
--------------
VALGRIND - NO SUPPRESSED
valgrind --leak-check=full --show-reachable=yes --track-origins=yes --show-leak-kinds=all ./gc_test
==40040== Memcheck, a memory error detector
==40040== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==40040== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==40040== Command: ./gc_test
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x489355F: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x489C6B7: UnknownInlinedFun (misc.c:1366)
==40040== by 0x489C6B7: GC_init (misc.c:926)
==40040== by 0x1012C4D: main (gc_test.cpp:36)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4893556: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x489C6B7: UnknownInlinedFun (misc.c:1366)
==40040== by 0x489C6B7: GC_init (misc.c:926)
==40040== by 0x1012C4D: main (gc_test.cpp:36)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x488319B: GC_mark_from (mark.c:721)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x489C6B7: UnknownInlinedFun (misc.c:1366)
==40040== by 0x489C6B7: GC_init (misc.c:926)
==40040== by 0x1012C4D: main (gc_test.cpp:36)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x490CD00: __libc_start_main@@GLIBC_2.34 (libc-start.c:242)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4883178: GC_mark_from (mark.c:731)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x489C6B7: UnknownInlinedFun (misc.c:1366)
==40040== by 0x489C6B7: GC_init (misc.c:926)
==40040== by 0x1012C4D: main (gc_test.cpp:36)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x490CD00: __libc_start_main@@GLIBC_2.34 (libc-start.c:242)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x48831A0: GC_mark_from (mark.c:721)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x489C6B7: UnknownInlinedFun (misc.c:1366)
==40040== by 0x489C6B7: GC_init (misc.c:926)
==40040== by 0x1012C4D: main (gc_test.cpp:36)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x490CC50: (below main) (libc_start_call_main.h:29)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4883173: GC_mark_from (mark.c:731)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x489C6B7: UnknownInlinedFun (misc.c:1366)
==40040== by 0x489C6B7: GC_init (misc.c:926)
==40040== by 0x1012C4D: main (gc_test.cpp:36)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x1012C20: main (gc_test.cpp:34)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4893582: UnknownInlinedFun (mark.c:1381)
==40040== by 0x4893582: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4893591: UnknownInlinedFun (mark.c:1381)
==40040== by 0x4893591: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x48935C5: UnknownInlinedFun (mark.c:1381)
==40040== by 0x48935C5: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882BB1: UnknownInlinedFun (headers.c:32)
==40040== by 0x4882BB1: GC_add_to_black_list_stack.lto_priv.0 (blacklst.c:222)
==40040== by 0x4893780: UnknownInlinedFun (mark.c:1391)
==40040== by 0x4893780: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4882BC6: UnknownInlinedFun (headers.c:32)
==40040== by 0x4882BC6: GC_add_to_black_list_stack.lto_priv.0 (blacklst.c:222)
==40040== by 0x4893780: UnknownInlinedFun (mark.c:1391)
==40040== by 0x4893780: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882BFD: GC_add_to_black_list_stack.lto_priv.0 (blacklst.c:222)
==40040== by 0x4893780: UnknownInlinedFun (mark.c:1391)
==40040== by 0x4893780: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882C13: GC_add_to_black_list_stack.lto_priv.0 (blacklst.c:222)
==40040== by 0x4893780: UnknownInlinedFun (mark.c:1391)
==40040== by 0x4893780: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882C17: GC_add_to_black_list_stack.lto_priv.0 (blacklst.c:222)
==40040== by 0x100007FFFFFF: ???
==40040== by 0xA3020302030202F: ???
==40040== by 0x3138312030757062: ???
==40040== by 0x3120313634203633: ???
==40040== by 0x3134312035373730: ???
==40040== by 0x3835342032313030: ???
==40040== by 0x3220313936382030: ???
==40040== by 0x203020302033302F: ???
==40040== by 0x3220317570630A2F: ???
==40040== by 0x3732312031303832: ???
==40040== by 0x2033383632312038: ???
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4882C1B: GC_add_to_black_list_stack.lto_priv.0 (blacklst.c:222)
==40040== by 0x4893780: UnknownInlinedFun (mark.c:1391)
==40040== by 0x4893780: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4893611: UnknownInlinedFun (gc_pmark.h:275)
==40040== by 0x4893611: UnknownInlinedFun (mark.c:1399)
==40040== by 0x4893611: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x489361B: UnknownInlinedFun (gc_pmark.h:279)
==40040== by 0x489361B: UnknownInlinedFun (mark.c:1399)
==40040== by 0x489361B: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4893626: UnknownInlinedFun (gc_pmark.h:348)
==40040== by 0x4893626: UnknownInlinedFun (mark.c:1399)
==40040== by 0x4893626: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4893658: UnknownInlinedFun (gc_pmark.h:348)
==40040== by 0x4893658: UnknownInlinedFun (mark.c:1399)
==40040== by 0x4893658: GC_push_all_eager (mark.c:1490)
==40040== by 0x489B422: GC_with_callee_saves_pushed (mach_dep.c:422)
==40040== by 0x489B64E: UnknownInlinedFun (mark_rts.c:878)
==40040== by 0x489B64E: GC_push_roots.lto_priv.0 (mark_rts.c:951)
==40040== by 0x48896C3: GC_mark_some (mark.c:376)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x489B3A0: GC_with_callee_saves_pushed (mach_dep.c:312)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x48831CB: GC_mark_from (mark.c:746)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x48831E4: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x48831E7: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882D6D: GC_header_cache_miss.lto_priv.0 (headers.c:55)
==40040== by 0x4883289: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4882D7C: GC_header_cache_miss.lto_priv.0 (headers.c:55)
==40040== by 0x4883289: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882DB5: GC_header_cache_miss.lto_priv.0 (headers.c:55)
==40040== by 0x4883289: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882E76: GC_header_cache_miss.lto_priv.0 (headers.c:95)
==40040== by 0x4883289: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x489324B: GC_push_contents_hdr.isra.0 (gc_pmark.h:275)
==40040== by 0x4883203: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4893255: GC_push_contents_hdr.isra.0 (gc_pmark.h:279)
==40040== by 0x4883203: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x489325C: GC_push_contents_hdr.isra.0 (gc_pmark.h:348)
==40040== by 0x4883203: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x48831ED: GC_mark_from (mark.c:757)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x4889B50: GC_stopped_mark (alloc.c:822)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x48831C6: GC_mark_from (mark.c:746)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488BF20: GC_try_to_collect_inner.lto_priv.0 (alloc.c:571)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4883231: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4883234: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882D6D: GC_header_cache_miss.lto_priv.0 (headers.c:55)
==40040== by 0x48832A9: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4882D7C: GC_header_cache_miss.lto_priv.0 (headers.c:55)
==40040== by 0x48832A9: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882DB5: GC_header_cache_miss.lto_priv.0 (headers.c:55)
==40040== by 0x48832A9: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4882E76: GC_header_cache_miss.lto_priv.0 (headers.c:95)
==40040== by 0x48832A9: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x489324B: GC_push_contents_hdr.isra.0 (gc_pmark.h:275)
==40040== by 0x488324C: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Conditional jump or move depends on uninitialised value(s)
==40040== at 0x4893255: GC_push_contents_hdr.isra.0 (gc_pmark.h:279)
==40040== by 0x488324C: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x489325C: GC_push_contents_hdr.isra.0 (gc_pmark.h:348)
==40040== by 0x488324C: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040== Use of uninitialised value of size 8
==40040== at 0x4893270: GC_push_contents_hdr.isra.0 (gc_pmark.h:348)
==40040== by 0x488324C: GC_mark_from (mark.c:773)
==40040== by 0x48891CE: GC_mark_some (mark.c:283)
==40040== by 0x4889D94: GC_stopped_mark (alloc.c:881)
==40040== by 0x488C078: GC_try_to_collect_inner.lto_priv.0 (alloc.c:628)
==40040== by 0x488C36E: GC_try_to_collect_general (alloc.c:1307)
==40040== by 0x488C490: GC_gcollect (alloc.c:1332)
==40040== by 0x4925B35: __run_exit_handlers (exit.c:108)
==40040== by 0x4925C7F: exit (exit.c:138)
==40040== by 0x490CCD6: (below main) (libc_start_call_main.h:74)
==40040== Uninitialised value was created by a stack allocation
==40040== at 0x488C2D0: GC_try_to_collect_general (alloc.c:1282)
==40040==
==40040==
==40040== HEAP SUMMARY:
==40040== in use at exit: 0 bytes in 0 blocks
==40040== total heap usage: 7 allocs, 7 frees, 2,072 bytes allocated
==40040==
==40040== All heap blocks were freed -- no leaks are possible
==40040==
==40040== For lists of detected and suppressed errors, rerun with: -s
==40040== ERROR SUMMARY: 481 errors from 41 contexts (suppressed: 0 from 0)
*/
// based on example from https://en.cppreference.com/w/cpp/memory/monotonic_buffer_resource
#include <array>
#include <chrono>
#include <cstddef>
#include <iomanip>
#include <iostream>
#include <list>
#include <memory_resource>
#include <gc_cpp.h>
class GCMemoryResource : public std::pmr::memory_resource {
public:
std::size_t size() {
return static_cast<std::size_t>(GC_get_heap_size());
}
protected:
void *do_allocate(std::size_t bytes, std::size_t /*alignment*/) override {
return GC_MALLOC(bytes);
}
void do_deallocate(void *p, std::size_t /*bytes*/,
std::size_t /*alignment*/) override {
GC_FREE(p);
}
bool do_is_equal(const memory_resource &other) const noexcept override {
return &other == this;
}
};
template<typename Func>
auto benchmark(Func test_func, int iterations)
{
const auto start = std::chrono::system_clock::now();
while (iterations-- > 0)
test_func();
const auto stop = std::chrono::system_clock::now();
const auto secs = std::chrono::duration<double>(stop - start);
return secs.count();
}
int main()
{
constexpr int iterations{100};
constexpr int total_nodes{2'00'000};
auto default_std_alloc = [total_nodes]
{
std::list<int> list;
for (int i{}; i != total_nodes; ++i)
list.push_back(i);
};
auto default_pmr_alloc = [total_nodes]
{
std::pmr::list<int> list;
for (int i{}; i != total_nodes; ++i)
list.push_back(i);
};
auto pmr_alloc_no_buf = [total_nodes]
{
std::pmr::monotonic_buffer_resource mbr;
std::pmr::polymorphic_allocator<int> pa{&mbr};
std::pmr::list<int> list{pa};
for (int i{}; i != total_nodes; ++i)
list.push_back(i);
};
auto pmr_alloc_and_buf = [total_nodes]
{
std::array<std::byte, total_nodes * 32> buffer; // enough to fit in all nodes
std::pmr::monotonic_buffer_resource mbr{buffer.data(), buffer.size()};
std::pmr::polymorphic_allocator<int> pa{&mbr};
std::pmr::list<int> list{pa};
for (int i{}; i != total_nodes; ++i)
list.push_back(i);
};
auto pmr_alloc_and_gc = [total_nodes]
{
GCMemoryResource gcmr;
std::pmr::polymorphic_allocator<int> pa{&gcmr};
std::pmr::list<int> list{pa};
for (int i{}; i != total_nodes; ++i)
list.push_back(i);
};
const double t1 = benchmark(default_std_alloc, iterations);
const double t2 = benchmark(default_pmr_alloc, iterations);
const double t3 = benchmark(pmr_alloc_no_buf , iterations);
const double t4 = benchmark(pmr_alloc_and_buf, iterations);
const double t5 = benchmark(pmr_alloc_and_gc, iterations);
std::cout << std::fixed << std::setprecision(3)
<< "t1 (default std alloc): " << t1 << " sec; t1/t1: " << t1/t1 << '\n'
<< "t2 (default pmr alloc): " << t2 << " sec; t1/t2: " << t1/t2 << '\n'
<< "t3 (pmr alloc no buf): " << t3 << " sec; t1/t3: " << t1/t3 << '\n'
<< "t4 (pmr alloc and buf): " << t4 << " sec; t1/t4: " << t1/t4 << '\n'
<< "t5 (pmr alloc and gc): " << t5 << " sec; t1/t5: " << t1/t5 << '\n';
}
/*
$ ./bench_pmr_and_gc
t1 (default std alloc): 0.274 sec; t1/t1: 1.000
t2 (default pmr alloc): 0.280 sec; t1/t2: 0.980
t3 (pmr alloc no buf): 0.099 sec; t1/t3: 2.785
t4 (pmr alloc and buf): 0.081 sec; t1/t4: 3.374
t5 (pmr alloc and gc): 0.279 sec; t1/t5: 0.982
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment