inline MemRef BasicArray<T>::create_array(size_t init_size, Allocator& allocator)
{
    size_t byte_size_0 = calc_aligned_byte_size(init_size); // Throws
    // Adding zero to Array::initial_capacity to avoid taking the
    // address of that member
    size_t byte_size = std::max(byte_size_0, Array::initial_capacity+0); // Throws

    MemRef mem = allocator.alloc(byte_size); // Throws

    bool is_inner_bptree_node = false;
    bool has_refs = false;
    bool context_flag = false;
    int width = sizeof (T);
    init_header(mem.get_addr(), is_inner_bptree_node, has_refs, context_flag, wtype_Multiply,
                width, init_size, byte_size);

    return mem;
}
Exemple #2
0
inline void Allocator::free_(MemRef mem) noexcept
{
    free_(mem.get_ref(), mem.get_addr());
}