Beispiel #1
0
MemInfo* NRT_MemInfo_alloc_safe_aligned(size_t size, unsigned align) {
    void *data = NULL;
    void *base = NRT_MemAlign(&data, size, align);
    memset(data, 0xCB, size);
    NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc_safe_aligned %p %llu\n",
                              data, size));
    return NRT_MemInfo_new(data, size, nrt_internal_aligned_safe_dtor, base);
}
Beispiel #2
0
MemInfo* NRT_MemInfo_alloc_safe(size_t size) {
    void *data = NRT_Allocate(size);
    /* Only fill up a couple cachelines with debug markers, to minimize
       overhead. */
    memset(data, 0xCB, MIN(size, 256));
    NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc_safe %p %llu\n", data, size));
    return NRT_MemInfo_new(data, size, nrt_internal_dtor_safe, (void*)size);
}
Beispiel #3
0
static NRT_MemInfo *
meminfo_new_from_pyobject(void *data, PyObject *ownerobj) {
    size_t dummy_size = 0;
    Py_INCREF(ownerobj);
    return NRT_MemInfo_new(data, dummy_size, pyobject_dtor, ownerobj);
}
Beispiel #4
0
MemInfo* NRT_MemInfo_alloc(size_t size) {
    void *data = NRT_Allocate(size);
    NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc %p\n", data));
    return NRT_MemInfo_new(data, size, nrt_internal_dtor, NULL);
}
Beispiel #5
0
MemInfo* NRT_MemInfo_alloc_safe(size_t size) {
    void *data = NRT_Allocate(size);
    memset(data, 0xCB, size);
    NRT_Debug(nrt_debug_print("NRT_MemInfo_alloc_safe %p %llu\n", data, size));
    return NRT_MemInfo_new(data, size, nrt_internal_dtor, (void*)size);
}