
value trigger_reached (gc.mem_new >= gc.mem_trigger)
value shared_trigger_reached (mem_shared >= mem_shared_trigger)

~ shared mem_usage_shared : uint
~ shared mem_usage_peak : uint
+ shared verify : bool (@undefined)

+ fn collect() {
    gc.collect()
}

+ fn lock() { gc.mutex.lock() }
+ fn unlock() { gc.mutex.unlock() }

+ fn collect_if_threshold_reached() {
    if trigger_reached {
        gc.collect()
        if shared_trigger_reached {
            collect_shared()
        }
    }
}

+ fn collect_shared_if_threshold_reached() {
    if shared_trigger_reached {
        collect_shared()
    }
}

+ fn alloc(size: uint) GcPtr {
    if size == 0 : return null.@cast(.)
    let pool = get_pool_for_size(size)
    let item = pool.get()
    let data = (@offset(item, u8, -8)).@cast(GcData)
    data.propc = 0
    return item.@cast(GcPtr)
}
