Example #1
0
File: nrt.c Project: jriehl/numba
MemInfo* NRT_MemSys_pop_meminfo(void) {
    MemInfo *node = nrt_pop_meminfo_list(&TheMSys.mi_freelist);
    if (NULL == node) {
        node = meminfo_malloc();
    }
    memset(node, 0, sizeof(MemInfo));   /* to catch bugs; not required */
    NRT_Debug(nrt_debug_print("NRT_MemSys_pop_meminfo: return %p\n", node));
    TheMSys.atomic_inc(&TheMSys.stats_mi_alloc);
    return node;
}
Example #2
0
File: nrt.c Project: jriehl/numba
void NRT_MemSys_insert_meminfo(MemInfo *newnode) {
    assert(newnode && "`newnode` cannot be NULL");
    /*
    if (NULL == newnode) {
        newnode = meminfo_malloc();
    } else {
        assert(newnode->payload.refct == 0 && "RefCt must be 0");
    }
    */
    assert(newnode->payload.refct == 0 && "RefCt must be 0");
    NRT_Debug(nrt_debug_print("NRT_MemSys_insert_meminfo newnode=%p\n",
                              newnode));
    memset(newnode, 0, sizeof(MemInfo));  /* to catch bugs; not required */
    nrt_push_meminfo_list(&TheMSys.mi_freelist, newnode);
    TheMSys.atomic_inc(&TheMSys.stats_mi_free);
}
Example #3
0
File: nrt.c Project: jriehl/numba
void NRT_Free(void *ptr) {
    NRT_Debug(nrt_debug_print("NRT_Free %p\n", ptr));
    free(ptr);
    TheMSys.atomic_inc(&TheMSys.stats_free);
}
Example #4
0
File: nrt.c Project: jriehl/numba
void* NRT_Allocate(size_t size) {
    void *ptr = malloc(size);
    NRT_Debug(nrt_debug_print("NRT_Allocate bytes=%llu ptr=%p\n", size, ptr));
    TheMSys.atomic_inc(&TheMSys.stats_alloc);
    return ptr;
}
Example #5
0
File: nrt.c Project: jriehl/numba
void NRT_MemInfo_acquire(MemInfo *mi) {
    NRT_Debug(nrt_debug_print("NRT_acquire %p refct=%zu\n", mi,
                                                            mi->payload.refct));
    assert(mi->payload.refct > 0 && "RefCt cannot be zero");
    TheMSys.atomic_inc(&mi->payload.refct);
}
Example #6
0
File: nrt.c Project: dboyliao/numba
void NRT_MemInfo_acquire(MemInfo *mi) {
    NRT_Debug(nrt_debug_print("NRT_acquire %p\n", mi));
    TheMSys.atomic_inc(&mi->payload.refct);
}