Index: src/examples/gc_no_raii/containers/vector
===================================================================
--- src/examples/gc_no_raii/containers/vector	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
+++ src/examples/gc_no_raii/containers/vector	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -0,0 +1,159 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// vector -- 
+// 
+// Author           : Thierry Delisle
+// Created On       : Tue Jul  5 18:00:07 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Jul  5 18:01:35 2016
+// Update Count     : 2
+// 
+
+#pragma once
+
+extern "C" {
+#include <stdbool.h>
+}
+
+#define DESTROY(x)
+
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t)
+{
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
+};
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+//------------------------------------------------------------------------------
+//Initialization
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void ctor(vector(T, allocator_t) *const this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void dtor(vector(T, allocator_t) *const this);
+
+//------------------------------------------------------------------------------
+//Capacity
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline bool empty(vector(T, allocator_t) *const this)
+{
+	return this->size == 0;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline size_t size(vector(T, allocator_t) *const this)
+{
+	return this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline void reserve(vector(T, allocator_t) *const this, size_t size)
+{
+	realloc(&this->storage, this->size+1);
+}
+
+//------------------------------------------------------------------------------
+//Element access
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T at(vector(T, allocator_t) *const this, size_t index)
+{
+	return data(&this->storage)[index];
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T ?[?](vector(T, allocator_t) *const this, size_t index)
+{
+	return data(&this->storage)[index];
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T front(vector(T, allocator_t) *const this)
+{
+	return data(&this->storage)[0];
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T back(vector(T, allocator_t) *const this)
+{
+	return data(&this->storage)[this->size - 1];
+}
+
+//------------------------------------------------------------------------------
+//Modifiers
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void push_back(vector(T, allocator_t) *const this, T value);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void pop_back(vector(T, allocator_t) *const this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void clear(vector(T, allocator_t) *const this);
+
+//------------------------------------------------------------------------------
+//Iterators
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T* begin(vector(T, allocator_t) *const this)
+{
+	return data(&this->storage);
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline const T* cbegin(const vector(T, allocator_t) *const this)
+{
+	return data(&this->storage);
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T* end(vector(T, allocator_t) *const this)
+{
+	return data(&this->storage) + this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline const T* cend(const vector(T, allocator_t) *const this)
+{
+	return data(&this->storage) + this->size;
+}
+
+//------------------------------------------------------------------------------
+//Allocator
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+void ctor(heap_allocator(T) *const this);
+
+forall(otype T)
+void dtor(heap_allocator(T) *const this);
+
+forall(otype T)
+void realloc(heap_allocator(T) *const this, size_t size);
+
+forall(otype T)
+static inline T* data(heap_allocator(T) *const this)
+{
+	return this->storage;
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/examples/gc_no_raii/containers/vector.c
===================================================================
--- src/examples/gc_no_raii/containers/vector.c	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
+++ src/examples/gc_no_raii/containers/vector.c	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -0,0 +1,92 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// vector.c -- 
+// 
+// Author           : Thierry Delisle
+// Created On       : Tue Jul  5 18:07:52 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Jul  5 18:08:31 2016
+// Update Count     : 2
+// 
+
+#include <containers/vector> 
+
+#include <stdlib>
+
+//------------------------------------------------------------------------------
+//Initialization
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void ctor(vector(T, allocator_t) *const this)
+{
+	ctor(&this->storage);
+	this->size = 0;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void dtor(vector(T, allocator_t) *const this)
+{
+	clear(this);
+	dtor(&this->storage);
+}
+
+//------------------------------------------------------------------------------
+//Modifiers
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void push_back(vector(T, allocator_t) *const this, T value)
+{
+	realloc(&this->storage, this->size+1);
+	data(&this->storage)[this->size] = value;
+	this->size++;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void pop_back(vector(T, allocator_t) *const this)
+{
+	this->size--;
+	DESTROY(data(&this->storage)[this->size]);
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void clear(vector(T, allocator_t) *const this)
+{
+	for(size_t i = 0; i < this->size; i++)
+	{
+		DESTROY(data(&this->storage)[this->size]);
+	}
+	this->size = 0;
+}
+
+//------------------------------------------------------------------------------
+//Allocator
+forall(otype T)
+void ctor(heap_allocator(T) *const this)
+{
+	this->storage = 0;
+	this->capacity = 0;
+}
+
+forall(otype T)
+void dtor(heap_allocator(T) *const this)
+{
+	free(this->storage);
+}
+
+forall(otype T)
+inline void realloc(heap_allocator(T) *const this, size_t size)
+{
+	enum { GROWTH_RATE = 2 };
+	if(size > this->capacity)
+	{
+		this->capacity = GROWTH_RATE * size;
+		this->storage = (T*)realloc((void*)this->storage, this->capacity * sizeof(T));
+	}
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/examples/gc_no_raii/premake4.lua
===================================================================
--- src/examples/gc_no_raii/premake4.lua	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/premake4.lua	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -6,4 +6,5 @@
 	"src/",
 	"../",
+	"containers/"
 }
 
@@ -48,5 +49,5 @@
 		linkoptions (linkOptionList)
 		includedirs (includeDirList)
-		files { "src/**.c" }
+		files { "src/**.c", "containers/**.c" }
 
 	configuration "debug"
Index: src/examples/gc_no_raii/src/gc.h
===================================================================
--- src/examples/gc_no_raii/src/gc.h	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/src/gc.h	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -4,18 +4,18 @@
 #include "internal/collector.h"
 
-forall(otype T)
-static inline gcpointer(T) gcmalloc()
-{
-    gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
-    ptr{};
-    gc_conditional_collect();
-    return ptr;
-}
+// forall(otype T)
+// static inline gcpointer(T) gcmalloc()
+// {
+//     gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
+//     ptr{};
+//     gc_conditional_collect();
+//     return ptr;
+// }
 
 forall(otype T)
 static inline void gcmalloc(gcpointer(T)* ptr)
 {
-	ptr{ gc_allocate(sizeof(T)) };
-      (*ptr){};
+	ptr { gc_allocate(sizeof(T)) };
+	get(ptr) {};
       gc_conditional_collect();
 }
Index: src/examples/gc_no_raii/src/gcpointers.c
===================================================================
--- src/examples/gc_no_raii/src/gcpointers.c	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/src/gcpointers.c	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -42,5 +42,5 @@
 }
 
-void gcpointer_ctor(gcpointer_t* this)
+void ?{}(gcpointer_t* this)
 {
 	this->ptr = (intptr_t)NULL;
@@ -48,5 +48,5 @@
 }
 
-void gcpointer_ctor(gcpointer_t* this, void* address)
+void ?{}(gcpointer_t* this, void* address)
 {
 	this->ptr = (intptr_t)address;
@@ -56,7 +56,7 @@
 }
 
-void gcpointer_ctor(gcpointer_t* this, gcpointer_t* other)
+void ?{}(gcpointer_t* this, gcpointer_t other)
 {
-	this->ptr = other->ptr;
+	this->ptr = other.ptr;
 	this->next = NULL;
 
@@ -64,5 +64,5 @@
 }
 
-void gcpointer_dtor(gcpointer_t* this)
+void ^?{}(gcpointer_t* this)
 {
 	unregister_ptr(this);
@@ -98,2 +98,30 @@
 	return this->ptr == (intptr_t)NULL;
 }
+
+forall(otype T) void ?{}(gcpointer(T)* this) {
+	(&this->internal) {};
+}
+
+forall(otype T) void ?{}(gcpointer(T)* this, void* address) {
+	(&this->internal) { address };
+}
+
+forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other) {
+	(&this->internal) { other->internal };
+}
+
+forall(otype T) void ^?{}(gcpointer(T)* this) {
+	^?{}(&this->internal);
+}
+
+// forall(otype T) gcpointer(T) ?=?(gcpointer(T) this, gcpointer(T) rhs);
+//
+// forall(otype T) T *?(gcpointer(T) this);
+
+forall(otype T) T* get(gcpointer(T)* this) {
+	return (T*)this->internal.ptr;
+}
+//
+// //Logical operators
+// forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs);
+// forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs);
Index: src/examples/gc_no_raii/src/gcpointers.h
===================================================================
--- src/examples/gc_no_raii/src/gcpointers.h	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/src/gcpointers.h	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -30,5 +30,4 @@
 forall(otype T) void ?{}(gcpointer(T)* this);
 forall(otype T) void ?{}(gcpointer(T)* this, void* address);
-forall(otype T) void ctor(gcpointer(T)* this, void* address);
 forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other);
 forall(otype T) void ^?{}(gcpointer(T)* this);
@@ -37,4 +36,5 @@
 
 forall(otype T) T *?(gcpointer(T) this);
+forall(otype T) T* get(gcpointer(T)* this);
 
 //Logical operators
Index: src/examples/gc_no_raii/src/internal/collector.c
===================================================================
--- src/examples/gc_no_raii/src/internal/collector.c	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/src/internal/collector.c	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -8,4 +8,6 @@
 }
 #endif
+
+#include <fstream>
 
 #include "state.h"
@@ -36,5 +38,10 @@
 void* gc_allocate(size_t target_size)
 {
+	sout | "Allocating " | target_size | " bytes" | endl;
+
 	size_t size = gc_compute_size(target_size + sizeof(gc_object_header));
+
+	sout | "Object header size: " | sizeof(gc_object_header) | " bytes" | endl;
+	sout | "Actual allocation size: " | size | " bytes" | endl;
 
 	check(size < POOL_SIZE_BYTES);
Index: src/examples/gc_no_raii/src/internal/state.h
===================================================================
--- src/examples/gc_no_raii/src/internal/state.h	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/src/internal/state.h	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -9,4 +9,5 @@
 }
 #endif
+#include <fstream>
 #include <vector>
 
@@ -37,4 +38,5 @@
 static inline bool gc_needs_collect(gc_state* state)
 {
+	sout | "Used Space: " | state->used_space | " bytes" | endl;
 	return state->used_space * 2 > state->total_space;
 }
Index: src/examples/gc_no_raii/test/gctest.c
===================================================================
--- src/examples/gc_no_raii/test/gctest.c	(revision e82aa9df9f1dc1335a759e00a2d82ca558fe6b0e)
+++ src/examples/gc_no_raii/test/gctest.c	(revision 6d665d93945a1e5430c7982fa468a2af88596f06)
@@ -2,4 +2,5 @@
 
 #include "gc.h"
+#include "internal/collector.h"
 
 #warning default test
@@ -8,7 +9,17 @@
 	sout | "Bonjour au monde!\n";
 
-	for(int i = 0; i < 1000000; i++) {
-		gcpointer(int) anInt;
-		gcmalloc(&anInt);
+	gcpointer(int) theInt;
+	gcmalloc(&theInt);
+
+	for(int i = 0; i < 10; i++) {
+		int a;
+		{
+			gcpointer(int) anInt;
+			gcmalloc(&anInt);
+		}
+		int p;
 	}
+
+	gc_collect(gc_get_state());
+	gc_conditional_collect();
 }
