source: src/examples/gc_no_raii/src/gc.h @ 6643e72

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 6643e72 was 6643e72, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

first basic test for garbage collector now compiles and works

  • Property mode set to 100644
File size: 408 bytes
Line 
1#pragma once
2
3#include "gcpointers.h"
4#include "internal/collector.h"
5
6// forall(otype T)
7// static inline gcpointer(T) gcmalloc()
8// {
9//     gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
10//     ptr{};
11//     gc_conditional_collect();
12//     return ptr;
13// }
14
15forall(otype T)
16static inline void gcmalloc(gcpointer(T)* ptr)
17{
18        ptr { gc_allocate(sizeof(T)) };
19        get(ptr) {};
20      gc_conditional_collect();
21}
Note: See TracBrowser for help on using the repository browser.